【fix sonar】FreemarkerParseFactory文件
This commit is contained in:
+6
-6
@@ -22,6 +22,10 @@ import java.util.regex.Pattern;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class FreemarkerParseFactory {
|
public class FreemarkerParseFactory {
|
||||||
|
|
||||||
|
private FreemarkerParseFactory(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private static final String ENCODE = "utf-8";
|
private static final String ENCODE = "utf-8";
|
||||||
/**
|
/**
|
||||||
* 参数格式化工具类
|
* 参数格式化工具类
|
||||||
@@ -100,8 +104,6 @@ public class FreemarkerParseFactory {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error(e.getMessage(), e.fillInStackTrace());
|
log.error(e.getMessage(), e.fillInStackTrace());
|
||||||
log.error("发送一次的模板key:{ " + tplName + " }");
|
log.error("发送一次的模板key:{ " + tplName + " }");
|
||||||
//System.err.println(e.getMessage());
|
|
||||||
//System.err.println("模板名:{ "+ tplName +" }");
|
|
||||||
throw new RuntimeException("解析SQL模板异常");
|
throw new RuntimeException("解析SQL模板异常");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -132,8 +134,6 @@ public class FreemarkerParseFactory {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error(e.getMessage(), e.fillInStackTrace());
|
log.error(e.getMessage(), e.fillInStackTrace());
|
||||||
log.error("发送一次的模板key:{ " + tplContent + " }");
|
log.error("发送一次的模板key:{ " + tplContent + " }");
|
||||||
//System.err.println(e.getMessage());
|
|
||||||
//System.err.println("模板内容:{ "+ tplContent +" }");
|
|
||||||
throw new RuntimeException("解析SQL模板异常");
|
throw new RuntimeException("解析SQL模板异常");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -144,8 +144,8 @@ public class FreemarkerParseFactory {
|
|||||||
private static String getSqlText(String sql) {
|
private static String getSqlText(String sql) {
|
||||||
// 将注释替换成""
|
// 将注释替换成""
|
||||||
sql = p.matcher(sql).replaceAll("");
|
sql = p.matcher(sql).replaceAll("");
|
||||||
sql = sql.replaceAll("\\n", " ").replaceAll("\\t", " ")
|
sql = sql.replace("\\n", " ").replace("\\t", " ")
|
||||||
.replaceAll("\\s{1,}", " ").trim();
|
.replace("\\s{1,}", " ").trim();
|
||||||
// 去掉 最后是 where这样的问题
|
// 去掉 最后是 where这样的问题
|
||||||
if (sql.endsWith("where") || sql.endsWith("where ")) {
|
if (sql.endsWith("where") || sql.endsWith("where ")) {
|
||||||
sql = sql.substring(0, sql.lastIndexOf("where"));
|
sql = sql.substring(0, sql.lastIndexOf("where"));
|
||||||
|
|||||||
Reference in New Issue
Block a user