提交 116b5276 authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Extract some local variables

上级 c5d11db4
...@@ -250,8 +250,8 @@ public class WebApp { ...@@ -250,8 +250,8 @@ public class WebApp {
private String autoCompleteList() { private String autoCompleteList() {
String query = (String) attributes.get("query"); String query = (String) attributes.get("query");
boolean lowercase = false; boolean lowercase = false;
if (query.trim().length() > 0 && String tQuery = query.trim();
Character.isLowerCase(query.trim().charAt(0))) { if (!tQuery.isEmpty() && Character.isLowerCase(tQuery.charAt(0))) {
lowercase = true; lowercase = true;
} }
try { try {
...@@ -281,7 +281,8 @@ public class WebApp { ...@@ -281,7 +281,8 @@ public class WebApp {
while (sql.length() > 0 && sql.charAt(0) <= ' ') { while (sql.length() > 0 && sql.charAt(0) <= ' ') {
sql = sql.substring(1); sql = sql.substring(1);
} }
if (sql.trim().length() > 0 && Character.isLowerCase(sql.trim().charAt(0))) { String tSql = sql.trim();
if (!tSql.isEmpty() && Character.isLowerCase(tSql.charAt(0))) {
lowercase = true; lowercase = true;
} }
Bnf bnf = session.getBnf(); Bnf bnf = session.getBnf();
...@@ -320,7 +321,7 @@ public class WebApp { ...@@ -320,7 +321,7 @@ public class WebApp {
list.add(type + "#" + key + "#" + value); list.add(type + "#" + key + "#" + value);
} }
Collections.sort(list); Collections.sort(list);
if (query.endsWith("\n") || query.trim().endsWith(";")) { if (query.endsWith("\n") || tQuery.endsWith(";")) {
list.add(0, "1#(Newline)#\n"); list.add(0, "1#(Newline)#\n");
} }
StatementBuilder buff = new StatementBuilder(); StatementBuilder buff = new StatementBuilder();
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论