分析阻断优化;修正代码生成选择多个验证条件的时候报错;
This commit is contained in:
@@ -39,9 +39,9 @@ public class CaptchaUtils {
|
||||
private static MarbleRippleFilterFactory mrff; // 大理石
|
||||
|
||||
private static void initialize(){
|
||||
if (ccs == null || true){
|
||||
if (ccs == null){
|
||||
synchronized (CaptchaUtils.class) {
|
||||
if (ccs == null || true){
|
||||
if (ccs == null){
|
||||
// 配置初始化
|
||||
ccs = new ConfigurableCaptchaService();
|
||||
|
||||
|
||||
@@ -736,7 +736,7 @@ public class FileUtils extends org.apache.commons.io.FileUtils {
|
||||
if (pastLength != 0) {
|
||||
response.setHeader("Accept-Ranges", "bytes");// 如果是第一次下,还没有断点续传,状态是默认的 200,无需显式设置;响应的格式是:HTTP/1.1 200 OK
|
||||
// 不是从最开始下载, 响应的格式是: Content-Range: bytes [文件块的开始字节]-[文件的总大小 - 1]/[文件的总大小]
|
||||
logger.debug("---------------不是从开始进行下载!服务器即将开始断点续传...");
|
||||
logger.debug("服务器即将开始断点续传...");
|
||||
switch (rangeSwitch) {
|
||||
case 1: { // 针对 bytes=27000- 的请求
|
||||
String contentRange = new StringBuffer("bytes ").append(new Long(pastLength).toString()).append("-")
|
||||
@@ -753,9 +753,6 @@ public class FileUtils extends org.apache.commons.io.FileUtils {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// 是从开始下载
|
||||
logger.debug("---------------是从开始进行下载!");
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -798,7 +795,7 @@ public class FileUtils extends org.apache.commons.io.FileUtils {
|
||||
}
|
||||
}
|
||||
out.flush();
|
||||
logger.debug("---------------下载完成!");
|
||||
logger.debug("下载完成!" + file.getAbsolutePath());
|
||||
} catch (IOException ie) {
|
||||
/**
|
||||
* 在写数据的时候, 对于 ClientAbortException 之类的异常,
|
||||
|
||||
@@ -438,9 +438,7 @@ public class VideoUtils {
|
||||
BufferedReader br = new BufferedReader(new InputStreamReader(__is));
|
||||
String line = null;
|
||||
while ((line = br.readLine()) != null) {
|
||||
if (line != null){
|
||||
log.debug(line);
|
||||
}
|
||||
log.debug(line);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
@@ -461,9 +459,7 @@ public class VideoUtils {
|
||||
BufferedReader br = new BufferedReader(new InputStreamReader(__is));
|
||||
String line = null;
|
||||
while ((line = br.readLine()) != null) {
|
||||
if (line != null){
|
||||
log.error(line);
|
||||
}
|
||||
log.error(line);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
||||
@@ -244,8 +244,9 @@ public class ClassUtils {
|
||||
if (test.matches(type)) {
|
||||
matches.add((Class<?>) type);
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
log.warn("Could not examine class '" + fqn + "'" + " due to a " + t.getClass().getName() + " with message: " + t.getMessage());
|
||||
} catch (Exception t) {
|
||||
log.warn("Could not examine class '" + fqn + "'" + " due to a "
|
||||
+ t.getClass().getName() + " with message: " + t.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -682,8 +683,12 @@ class DefaultVFS extends VFS {
|
||||
// Failure to read the stream means this is not a JAR
|
||||
} finally {
|
||||
try {
|
||||
is.close();
|
||||
} catch (Exception e) {}
|
||||
if (is != null){
|
||||
is.close();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
@@ -849,7 +849,7 @@ public class DiffMatchPatch {
|
||||
thisDiff = pointer.next();
|
||||
}
|
||||
}
|
||||
while (thisDiff != null) {
|
||||
while (prevDiff != null && thisDiff != null) { // while (thisDiff != null) { ThinkGem
|
||||
if (prevDiff.operation == Operation.DELETE &&
|
||||
thisDiff.operation == Operation.INSERT) {
|
||||
String deletion = prevDiff.text;
|
||||
|
||||
@@ -409,33 +409,35 @@ public class ExcelImport {
|
||||
}
|
||||
//log.debug("Import value type: ["+i+","+column+"] " + valType);
|
||||
try {
|
||||
if (valType == String.class){
|
||||
String s = String.valueOf(val.toString());
|
||||
if(StringUtils.endsWith(s, ".0")){
|
||||
val = StringUtils.substringBefore(s, ".0");
|
||||
if (val != null){
|
||||
if (valType == String.class){
|
||||
String s = String.valueOf(val.toString());
|
||||
if(StringUtils.endsWith(s, ".0")){
|
||||
val = StringUtils.substringBefore(s, ".0");
|
||||
}else{
|
||||
val = String.valueOf(val.toString());
|
||||
}
|
||||
}else if (valType == Integer.class){
|
||||
val = Double.valueOf(val.toString()).intValue();
|
||||
}else if (valType == Long.class){
|
||||
val = Double.valueOf(val.toString()).longValue();
|
||||
}else if (valType == Double.class){
|
||||
val = Double.valueOf(val.toString());
|
||||
}else if (valType == Float.class){
|
||||
val = Float.valueOf(val.toString());
|
||||
}else if (valType == Date.class){
|
||||
if (val instanceof String){
|
||||
val = DateUtils.parseDate(val);
|
||||
}else if (val instanceof Double){
|
||||
val = DateUtil.getJavaDate((Double)val); // POI Excel 日期格式转换
|
||||
}
|
||||
}else{
|
||||
val = String.valueOf(val.toString());
|
||||
}
|
||||
}else if (valType == Integer.class){
|
||||
val = Double.valueOf(val.toString()).intValue();
|
||||
}else if (valType == Long.class){
|
||||
val = Double.valueOf(val.toString()).longValue();
|
||||
}else if (valType == Double.class){
|
||||
val = Double.valueOf(val.toString());
|
||||
}else if (valType == Float.class){
|
||||
val = Float.valueOf(val.toString());
|
||||
}else if (valType == Date.class){
|
||||
if (val instanceof String){
|
||||
val = DateUtils.parseDate(val);
|
||||
}else if (val instanceof Double){
|
||||
val = DateUtil.getJavaDate((Double)val); // POI Excel 日期格式转换
|
||||
}
|
||||
}else{
|
||||
if (ef.fieldType() != Class.class){
|
||||
val = ef.fieldType().getMethod("getValue", String.class).invoke(null, val.toString());
|
||||
}else{
|
||||
val = Class.forName(this.getClass().getName().replaceAll(this.getClass().getSimpleName(),
|
||||
"fieldtype."+valType.getSimpleName()+"Type")).getMethod("getValue", String.class).invoke(null, val.toString());
|
||||
if (ef.fieldType() != Class.class){
|
||||
val = ef.fieldType().getMethod("getValue", String.class).invoke(null, val.toString());
|
||||
}else{
|
||||
val = Class.forName(this.getClass().getName().replaceAll(this.getClass().getSimpleName(),
|
||||
"fieldtype."+valType.getSimpleName()+"Type")).getMethod("getValue", String.class).invoke(null, val.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
|
||||
@@ -110,28 +110,45 @@ public abstract class ExcelWriter {
|
||||
* @param entry the name of the sheet entry to substitute, e.g. xl/worksheets/sheet1.xml
|
||||
* @param out the stream to write the result to
|
||||
*/
|
||||
@SuppressWarnings("resource")
|
||||
private static void substitute(File zipfile, File tmpfile, String entry,
|
||||
OutputStream out) throws IOException {
|
||||
ZipFile zip = new ZipFile(zipfile);
|
||||
ZipOutputStream zos = new ZipOutputStream(out);
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
Enumeration<ZipEntry> en = (Enumeration<ZipEntry>) zip.entries();
|
||||
while (en.hasMoreElements()) {
|
||||
ZipEntry ze = en.nextElement();
|
||||
if (!ze.getName().equals(entry)) {
|
||||
zos.putNextEntry(new ZipEntry(ze.getName()));
|
||||
InputStream is = zip.getInputStream(ze);
|
||||
copyStream(is, zos);
|
||||
ZipFile zip = null;
|
||||
ZipOutputStream zos = null;
|
||||
InputStream is = null;
|
||||
try{
|
||||
zip = new ZipFile(zipfile);
|
||||
zos = new ZipOutputStream(out);
|
||||
@SuppressWarnings("unchecked")
|
||||
Enumeration<ZipEntry> en = (Enumeration<ZipEntry>) zip.entries();
|
||||
while (en.hasMoreElements()) {
|
||||
ZipEntry ze = en.nextElement();
|
||||
if (!ze.getName().equals(entry)) {
|
||||
zos.putNextEntry(new ZipEntry(ze.getName()));
|
||||
InputStream is2 = null;
|
||||
try{
|
||||
is2 = zip.getInputStream(ze);
|
||||
copyStream(is2, zos);
|
||||
}finally {
|
||||
if (is2 != null){
|
||||
is2.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
zos.putNextEntry(new ZipEntry(entry));
|
||||
is = new FileInputStream(tmpfile);
|
||||
copyStream(is, zos);
|
||||
}finally {
|
||||
if (is != null){
|
||||
is.close();
|
||||
}
|
||||
if (zos != null){
|
||||
zos.close();
|
||||
}
|
||||
if (zip != null){
|
||||
zip.close();
|
||||
}
|
||||
}
|
||||
zos.putNextEntry(new ZipEntry(entry));
|
||||
InputStream is = new FileInputStream(tmpfile);
|
||||
copyStream(is, zos);
|
||||
is.close();
|
||||
zos.close();
|
||||
}
|
||||
|
||||
private static void copyStream(InputStream in, OutputStream out)
|
||||
|
||||
@@ -214,15 +214,18 @@ public class WordExport {
|
||||
FileOutputStream fos = null;
|
||||
try {
|
||||
fos = new FileOutputStream(newFile);
|
||||
this.document.write(fos);
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
this.document.write(fos);
|
||||
fos.flush();
|
||||
fos.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
try {
|
||||
fos.flush();
|
||||
fos.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -74,10 +74,12 @@ public class CodeStatistic {
|
||||
* @param f
|
||||
*/
|
||||
private static void count(File f) {
|
||||
FileReader fr = null;
|
||||
BufferedReader br = null;
|
||||
boolean flag = false;
|
||||
try {
|
||||
br = new BufferedReader(new FileReader(f));
|
||||
fr = new FileReader(f);
|
||||
br = new BufferedReader(fr);
|
||||
String line = "";
|
||||
while ((line = br.readLine()) != null) {
|
||||
line = line.trim(); // 除去注释前的空格
|
||||
@@ -113,6 +115,14 @@ public class CodeStatistic {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
if (fr != null){
|
||||
try {
|
||||
fr.close();
|
||||
fr = null;
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user