mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
fix sonar rule check violations
This commit is contained in:
@@ -73,7 +73,7 @@ public class ConfigFilter extends FilterAdapter {
|
||||
return algorithm;
|
||||
}
|
||||
|
||||
public void setAlgorithm(String algorithm) {
|
||||
public final void setAlgorithm(String algorithm) {
|
||||
this.algorithm = algorithm;
|
||||
try {
|
||||
this.cipher = Cipher.getInstance(algorithm);
|
||||
@@ -86,7 +86,7 @@ public class ConfigFilter extends FilterAdapter {
|
||||
return encryptedPassword;
|
||||
}
|
||||
|
||||
public void setEncryptedPassword(String encryptedPassword) {
|
||||
public final void setEncryptedPassword(String encryptedPassword) {
|
||||
this.encryptedPassword = encryptedPassword;
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ public class ConfigFilter extends FilterAdapter {
|
||||
return key;
|
||||
}
|
||||
|
||||
public void setKey(String key) {
|
||||
public final void setKey(String key) {
|
||||
this.key = key;
|
||||
|
||||
byte[] bytes = Base64.base64ToByteArray(key);
|
||||
|
||||
@@ -233,7 +233,7 @@ public class EncodingConvertFilter extends FilterAdapter {
|
||||
|
||||
return charsetConvert.encode(s);
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
throw new SQLException(e.getMessage());
|
||||
throw new SQLException(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -242,7 +242,7 @@ public class EncodingConvertFilter extends FilterAdapter {
|
||||
CharsetConvert charsetConvert = (CharsetConvert) connection.getAttributes().get(ATTR_CHARSET_CONVERTER);
|
||||
return charsetConvert.decode(s);
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
throw new SQLException(e.getMessage());
|
||||
throw new SQLException(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -250,9 +250,9 @@ public class DruidDriver implements Driver, DruidDriverMBean {
|
||||
try {
|
||||
rawDriver = (Driver) rawDriverClass.newInstance();
|
||||
} catch (InstantiationException e) {
|
||||
throw new SQLException("create driver instance error, driver className '" + className + "'");
|
||||
throw new SQLException("create driver instance error, driver className '" + className + "'", e);
|
||||
} catch (IllegalAccessException e) {
|
||||
throw new SQLException("create driver instance error, driver className '" + className + "'");
|
||||
throw new SQLException("create driver instance error, driver className '" + className + "'", e);
|
||||
}
|
||||
|
||||
return rawDriver;
|
||||
|
||||
@@ -317,8 +317,8 @@ public class MySqlExprParser extends SQLExprParser {
|
||||
|
||||
if (lexer.token() == Token.FOR) {
|
||||
lexer.nextToken();
|
||||
SQLExpr _for = expr();
|
||||
methodInvokeExpr.putAttribute("FOR", _for);
|
||||
SQLExpr forExpr = expr();
|
||||
methodInvokeExpr.putAttribute("FOR", forExpr);
|
||||
}
|
||||
break;
|
||||
} else if (lexer.token() == Token.RPAREN) {
|
||||
|
||||
+78
-63
@@ -129,7 +129,22 @@ import com.alibaba.druid.sql.parser.Token;
|
||||
|
||||
public class MySqlStatementParser extends SQLStatementParser {
|
||||
|
||||
private static final String RESET = "RESET";
|
||||
private static final String COLLATE2 = "COLLATE";
|
||||
private static final String CASCADE = "CASCADE";
|
||||
private static final String RESTRICT = "RESTRICT";
|
||||
private static final String CHAIN = "CHAIN";
|
||||
private static final String ENGINES = "ENGINES";
|
||||
private static final String ENGINE = "ENGINE";
|
||||
private static final String BINLOG = "BINLOG";
|
||||
private static final String EVENTS = "EVENTS";
|
||||
private static final String CHARACTER = "CHARACTER";
|
||||
private static final String SESSION = "SESSION";
|
||||
private static final String GLOBAL = "GLOBAL";
|
||||
private static final String VARIABLES = "VARIABLES";
|
||||
private static final String ERRORS = "ERRORS";
|
||||
private static final String STATUS = "STATUS";
|
||||
private static final String IGNORE = "IGNORE";
|
||||
private static final String RESET = "RESET";
|
||||
private static final String DESCRIBE = "DESCRIBE";
|
||||
private static final String DESC = "DESC";
|
||||
private static final String WRITE = "WRITE";
|
||||
@@ -144,7 +159,7 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
private static final String DELAYED = "DELAYED";
|
||||
private static final String LOW_PRIORITY = "LOW_PRIORITY";
|
||||
|
||||
public MySqlStatementParser(String sql) {
|
||||
public MySqlStatementParser(String sql){
|
||||
super(new MySqlExprParser(sql));
|
||||
}
|
||||
|
||||
@@ -172,7 +187,7 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
stmt.setLowPriority(true);
|
||||
}
|
||||
|
||||
if (identifierEquals("IGNORE")) {
|
||||
if (identifierEquals(IGNORE)) {
|
||||
lexer.nextToken();
|
||||
stmt.setIgnore(true);
|
||||
}
|
||||
@@ -235,7 +250,7 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
lexer.nextToken();
|
||||
}
|
||||
|
||||
if (identifierEquals("IGNORE")) {
|
||||
if (identifierEquals(IGNORE)) {
|
||||
deleteStatement.setIgnore(true);
|
||||
lexer.nextToken();
|
||||
}
|
||||
@@ -514,7 +529,7 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (identifierEquals("BINLOG")) {
|
||||
if (identifierEquals(BINLOG)) {
|
||||
SQLStatement stmt = parseBinlog();
|
||||
statementList.add(stmt);
|
||||
return true;
|
||||
@@ -649,7 +664,7 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
accept(Token.STAR);
|
||||
accept(Token.RPAREN);
|
||||
|
||||
if (identifierEquals("ERRORS")) {
|
||||
if (identifierEquals(ERRORS)) {
|
||||
lexer.nextToken();
|
||||
|
||||
MySqlShowErrorsStatement stmt = new MySqlShowErrorsStatement();
|
||||
@@ -666,7 +681,7 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
}
|
||||
}
|
||||
|
||||
if (identifierEquals("ERRORS")) {
|
||||
if (identifierEquals(ERRORS)) {
|
||||
lexer.nextToken();
|
||||
|
||||
MySqlShowErrorsStatement stmt = new MySqlShowErrorsStatement();
|
||||
@@ -675,7 +690,7 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
return stmt;
|
||||
}
|
||||
|
||||
if (identifierEquals("STATUS")) {
|
||||
if (identifierEquals(STATUS)) {
|
||||
lexer.nextToken();
|
||||
|
||||
MySqlShowStatusStatement stmt = parseShowStatus();
|
||||
@@ -683,7 +698,7 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
return stmt;
|
||||
}
|
||||
|
||||
if (identifierEquals("VARIABLES")) {
|
||||
if (identifierEquals(VARIABLES)) {
|
||||
lexer.nextToken();
|
||||
|
||||
MySqlShowVariantsStatement stmt = parseShowVariants();
|
||||
@@ -691,17 +706,17 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
return stmt;
|
||||
}
|
||||
|
||||
if (identifierEquals("GLOBAL")) {
|
||||
if (identifierEquals(GLOBAL)) {
|
||||
lexer.nextToken();
|
||||
|
||||
if (identifierEquals("STATUS")) {
|
||||
if (identifierEquals(STATUS)) {
|
||||
lexer.nextToken();
|
||||
MySqlShowStatusStatement stmt = parseShowStatus();
|
||||
stmt.setGlobal(true);
|
||||
return stmt;
|
||||
}
|
||||
|
||||
if (identifierEquals("VARIABLES")) {
|
||||
if (identifierEquals(VARIABLES)) {
|
||||
lexer.nextToken();
|
||||
MySqlShowVariantsStatement stmt = parseShowVariants();
|
||||
stmt.setGlobal(true);
|
||||
@@ -709,17 +724,17 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
}
|
||||
}
|
||||
|
||||
if (identifierEquals("SESSION")) {
|
||||
if (identifierEquals(SESSION)) {
|
||||
lexer.nextToken();
|
||||
|
||||
if (identifierEquals("STATUS")) {
|
||||
if (identifierEquals(STATUS)) {
|
||||
lexer.nextToken();
|
||||
MySqlShowStatusStatement stmt = parseShowStatus();
|
||||
stmt.setSession(true);
|
||||
return stmt;
|
||||
}
|
||||
|
||||
if (identifierEquals("VARIABLES")) {
|
||||
if (identifierEquals(VARIABLES)) {
|
||||
lexer.nextToken();
|
||||
MySqlShowVariantsStatement stmt = parseShowVariants();
|
||||
stmt.setSession(true);
|
||||
@@ -749,11 +764,11 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
lexer.nextToken();
|
||||
return new MySqlShowMasterLogsStatement();
|
||||
}
|
||||
acceptIdentifier("STATUS");
|
||||
acceptIdentifier(STATUS);
|
||||
return new MySqlShowMasterStatusStatement();
|
||||
}
|
||||
|
||||
if (identifierEquals("CHARACTER")) {
|
||||
if (identifierEquals(CHARACTER)) {
|
||||
lexer.nextToken();
|
||||
accept(Token.SET);
|
||||
MySqlShowCharacterSetStatement stmt = new MySqlShowCharacterSetStatement();
|
||||
@@ -788,9 +803,9 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
return stmt;
|
||||
}
|
||||
|
||||
if (identifierEquals("BINLOG")) {
|
||||
if (identifierEquals(BINLOG)) {
|
||||
lexer.nextToken();
|
||||
acceptIdentifier("EVENTS");
|
||||
acceptIdentifier(EVENTS);
|
||||
MySqlShowBinLogEventsStatement stmt = new MySqlShowBinLogEventsStatement();
|
||||
|
||||
if (lexer.token() == Token.IN) {
|
||||
@@ -875,7 +890,7 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
throw new ParserException("TODO " + lexer.stringVal());
|
||||
}
|
||||
|
||||
if (identifierEquals("ENGINE")) {
|
||||
if (identifierEquals(ENGINE)) {
|
||||
lexer.nextToken();
|
||||
MySqlShowEngineStatement stmt = new MySqlShowEngineStatement();
|
||||
stmt.setName(this.exprParser.name());
|
||||
@@ -886,19 +901,19 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
|
||||
if (identifierEquals("STORAGE")) {
|
||||
lexer.nextToken();
|
||||
acceptIdentifier("ENGINES");
|
||||
acceptIdentifier(ENGINES);
|
||||
MySqlShowEnginesStatement stmt = new MySqlShowEnginesStatement();
|
||||
stmt.setStorage(true);
|
||||
return stmt;
|
||||
}
|
||||
|
||||
if (identifierEquals("ENGINES")) {
|
||||
if (identifierEquals(ENGINES)) {
|
||||
lexer.nextToken();
|
||||
MySqlShowEnginesStatement stmt = new MySqlShowEnginesStatement();
|
||||
return stmt;
|
||||
}
|
||||
|
||||
if (identifierEquals("EVENTS")) {
|
||||
if (identifierEquals(EVENTS)) {
|
||||
lexer.nextToken();
|
||||
MySqlShowEventsStatement stmt = new MySqlShowEventsStatement();
|
||||
|
||||
@@ -929,7 +944,7 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
return stmt;
|
||||
}
|
||||
|
||||
acceptIdentifier("STATUS");
|
||||
acceptIdentifier(STATUS);
|
||||
MySqlShowFunctionStatusStatement stmt = new MySqlShowFunctionStatusStatement();
|
||||
|
||||
if (lexer.token() == Token.LIKE) {
|
||||
@@ -946,7 +961,7 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
|
||||
// MySqlShowFunctionStatusStatement
|
||||
|
||||
if (identifierEquals("ENGINE")) {
|
||||
if (identifierEquals(ENGINE)) {
|
||||
lexer.nextToken();
|
||||
MySqlShowEngineStatement stmt = new MySqlShowEngineStatement();
|
||||
stmt.setName(this.exprParser.name());
|
||||
@@ -957,13 +972,13 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
|
||||
if (identifierEquals("STORAGE")) {
|
||||
lexer.nextToken();
|
||||
acceptIdentifier("ENGINES");
|
||||
acceptIdentifier(ENGINES);
|
||||
MySqlShowEnginesStatement stmt = new MySqlShowEnginesStatement();
|
||||
stmt.setStorage(true);
|
||||
return stmt;
|
||||
}
|
||||
|
||||
if (identifierEquals("ENGINES")) {
|
||||
if (identifierEquals(ENGINES)) {
|
||||
lexer.nextToken();
|
||||
MySqlShowEnginesStatement stmt = new MySqlShowEnginesStatement();
|
||||
return stmt;
|
||||
@@ -1063,7 +1078,7 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
return stmt;
|
||||
}
|
||||
|
||||
acceptIdentifier("STATUS");
|
||||
acceptIdentifier(STATUS);
|
||||
MySqlShowProcedureStatusStatement stmt = new MySqlShowProcedureStatusStatement();
|
||||
|
||||
if (lexer.token() == Token.LIKE) {
|
||||
@@ -1149,7 +1164,7 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
|
||||
if (identifierEquals("RELAYLOG")) {
|
||||
lexer.nextToken();
|
||||
acceptIdentifier("EVENTS");
|
||||
acceptIdentifier(EVENTS);
|
||||
MySqlShowRelayLogEventsStatement stmt = new MySqlShowRelayLogEventsStatement();
|
||||
|
||||
if (lexer.token() == Token.IN) {
|
||||
@@ -1169,7 +1184,7 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
|
||||
if (identifierEquals("RELAYLOG")) {
|
||||
lexer.nextToken();
|
||||
acceptIdentifier("EVENTS");
|
||||
acceptIdentifier(EVENTS);
|
||||
MySqlShowRelayLogEventsStatement stmt = new MySqlShowRelayLogEventsStatement();
|
||||
|
||||
if (lexer.token() == Token.IN) {
|
||||
@@ -1189,7 +1204,7 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
|
||||
if (identifierEquals("SLAVE")) {
|
||||
lexer.nextToken();
|
||||
if (identifierEquals("STATUS")) {
|
||||
if (identifierEquals(STATUS)) {
|
||||
lexer.nextToken();
|
||||
return new MySqlShowSlaveStatusStatement();
|
||||
} else {
|
||||
@@ -1201,7 +1216,7 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
|
||||
if (lexer.token() == Token.TABLE) {
|
||||
lexer.nextToken();
|
||||
acceptIdentifier("STATUS");
|
||||
acceptIdentifier(STATUS);
|
||||
MySqlShowTableStatusStatement stmt = new MySqlShowTableStatusStatement();
|
||||
if (lexer.token() == Token.FROM || lexer.token() == Token.IN) {
|
||||
lexer.nextToken();
|
||||
@@ -1405,10 +1420,10 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
lexer.nextToken();
|
||||
if (lexer.token() == Token.NOT) {
|
||||
lexer.nextToken();
|
||||
acceptIdentifier("CHAIN");
|
||||
acceptIdentifier(CHAIN);
|
||||
stmt.setChain(Boolean.FALSE);
|
||||
} else {
|
||||
acceptIdentifier("CHAIN");
|
||||
acceptIdentifier(CHAIN);
|
||||
stmt.setChain(Boolean.TRUE);
|
||||
}
|
||||
}
|
||||
@@ -1440,10 +1455,10 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
lexer.nextToken();
|
||||
if (lexer.token() == Token.NOT) {
|
||||
lexer.nextToken();
|
||||
acceptIdentifier("CHAIN");
|
||||
acceptIdentifier(CHAIN);
|
||||
stmt.setChain(Boolean.FALSE);
|
||||
} else {
|
||||
acceptIdentifier("CHAIN");
|
||||
acceptIdentifier(CHAIN);
|
||||
stmt.setChain(Boolean.TRUE);
|
||||
}
|
||||
}
|
||||
@@ -1581,7 +1596,7 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
lexer.nextToken();
|
||||
}
|
||||
|
||||
if (identifierEquals("IGNORE")) {
|
||||
if (identifierEquals(IGNORE)) {
|
||||
stmt.setIgnore(true);
|
||||
lexer.nextToken();
|
||||
}
|
||||
@@ -1592,7 +1607,7 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
SQLName tableName = exprParser.name();
|
||||
stmt.setTableName(tableName);
|
||||
|
||||
if (identifierEquals("CHARACTER")) {
|
||||
if (identifierEquals(CHARACTER)) {
|
||||
lexer.nextToken();
|
||||
accept(Token.SET);
|
||||
|
||||
@@ -1613,7 +1628,7 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
stmt.setRowsIdentifiedBy(rowsIdentifiedBy);
|
||||
}
|
||||
|
||||
if (identifierEquals("IGNORE")) {
|
||||
if (identifierEquals(IGNORE)) {
|
||||
throw new ParserException("TODO");
|
||||
}
|
||||
|
||||
@@ -1654,7 +1669,7 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
lexer.nextToken();
|
||||
}
|
||||
|
||||
if (identifierEquals("IGNORE")) {
|
||||
if (identifierEquals(IGNORE)) {
|
||||
stmt.setIgnore(true);
|
||||
lexer.nextToken();
|
||||
}
|
||||
@@ -1665,7 +1680,7 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
SQLName tableName = exprParser.name();
|
||||
stmt.setTableName(tableName);
|
||||
|
||||
if (identifierEquals("CHARACTER")) {
|
||||
if (identifierEquals(CHARACTER)) {
|
||||
lexer.nextToken();
|
||||
accept(Token.SET);
|
||||
|
||||
@@ -1686,7 +1701,7 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
throw new ParserException("TODO");
|
||||
}
|
||||
|
||||
if (identifierEquals("IGNORE")) {
|
||||
if (identifierEquals(IGNORE)) {
|
||||
throw new ParserException("TODO");
|
||||
}
|
||||
|
||||
@@ -1744,7 +1759,7 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
lexer.nextToken();
|
||||
}
|
||||
|
||||
if (identifierEquals("IGNORE")) {
|
||||
if (identifierEquals(IGNORE)) {
|
||||
insertStatement.setIgnore(true);
|
||||
lexer.nextToken();
|
||||
}
|
||||
@@ -1887,11 +1902,11 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
break;
|
||||
}
|
||||
|
||||
if (identifierEquals("RESTRICT")) {
|
||||
stmt.setOption("RESTRICT");
|
||||
if (identifierEquals(RESTRICT)) {
|
||||
stmt.setOption(RESTRICT);
|
||||
lexer.nextToken();
|
||||
} else if (identifierEquals("CASCADE")) {
|
||||
stmt.setOption("CASCADE");
|
||||
} else if (identifierEquals(CASCADE)) {
|
||||
stmt.setOption(CASCADE);
|
||||
lexer.nextToken();
|
||||
}
|
||||
|
||||
@@ -1923,11 +1938,11 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
break;
|
||||
}
|
||||
|
||||
if (identifierEquals("RESTRICT")) {
|
||||
stmt.setOption("RESTRICT");
|
||||
if (identifierEquals(RESTRICT)) {
|
||||
stmt.setOption(RESTRICT);
|
||||
lexer.nextToken();
|
||||
} else if (identifierEquals("CASCADE")) {
|
||||
stmt.setOption("CASCADE");
|
||||
} else if (identifierEquals(CASCADE)) {
|
||||
stmt.setOption(CASCADE);
|
||||
lexer.nextToken();
|
||||
}
|
||||
|
||||
@@ -1942,10 +1957,10 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
accept(Token.SET);
|
||||
|
||||
Boolean global = null;
|
||||
if (identifierEquals("GLOBAL")) {
|
||||
if (identifierEquals(GLOBAL)) {
|
||||
global = Boolean.TRUE;
|
||||
lexer.nextToken();
|
||||
} else if (identifierEquals("SESSION")) {
|
||||
} else if (identifierEquals(SESSION)) {
|
||||
global = Boolean.FALSE;
|
||||
lexer.nextToken();
|
||||
}
|
||||
@@ -2003,7 +2018,7 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
String charSet = lexer.stringVal();
|
||||
stmt.setCharSet(charSet);
|
||||
lexer.nextToken();
|
||||
if (identifierEquals("COLLATE")) {
|
||||
if (identifierEquals(COLLATE2)) {
|
||||
lexer.nextToken();
|
||||
|
||||
String collate = lexer.stringVal();
|
||||
@@ -2012,7 +2027,7 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
}
|
||||
}
|
||||
return stmt;
|
||||
} else if (identifierEquals("CHARACTER")) {
|
||||
} else if (identifierEquals(CHARACTER)) {
|
||||
lexer.nextToken();
|
||||
|
||||
accept(Token.SET);
|
||||
@@ -2025,7 +2040,7 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
String charSet = lexer.stringVal();
|
||||
stmt.setCharSet(charSet);
|
||||
lexer.nextToken();
|
||||
if (identifierEquals("COLLATE")) {
|
||||
if (identifierEquals(COLLATE2)) {
|
||||
lexer.nextToken();
|
||||
|
||||
String collate = lexer.stringVal();
|
||||
@@ -2057,7 +2072,7 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
|
||||
boolean ignore = false;
|
||||
|
||||
if (identifierEquals("IGNORE")) {
|
||||
if (identifierEquals(IGNORE)) {
|
||||
ignore = true;
|
||||
lexer.nextToken();
|
||||
}
|
||||
@@ -2221,15 +2236,15 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
|
||||
} else if (identifierEquals("REMOVE")) {
|
||||
throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
|
||||
} else if (identifierEquals("ENGINE")) {
|
||||
} else if (identifierEquals(ENGINE)) {
|
||||
lexer.nextToken();
|
||||
accept(Token.EQ);
|
||||
stmt.getItems().add(new MySqlAlterTableOption("ENGINE", lexer.stringVal()));
|
||||
stmt.getItems().add(new MySqlAlterTableOption(ENGINE, lexer.stringVal()));
|
||||
lexer.nextToken();
|
||||
} else if (identifierEquals("COLLATE")) {
|
||||
} else if (identifierEquals(COLLATE2)) {
|
||||
lexer.nextToken();
|
||||
accept(Token.EQ);
|
||||
stmt.getItems().add(new MySqlAlterTableOption("COLLATE", lexer.stringVal()));
|
||||
stmt.getItems().add(new MySqlAlterTableOption(COLLATE2, lexer.stringVal()));
|
||||
lexer.nextToken();
|
||||
} else if (identifierEquals("PACK_KEYS")) {
|
||||
lexer.nextToken();
|
||||
@@ -2242,7 +2257,7 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
stmt.getItems().add(new MySqlAlterTableOption("PACK_KEYS", lexer.stringVal()));
|
||||
lexer.nextToken();
|
||||
}
|
||||
} else if (identifierEquals("CHARACTER")) {
|
||||
} else if (identifierEquals(CHARACTER)) {
|
||||
lexer.nextToken();
|
||||
accept(Token.SET);
|
||||
accept(Token.EQ);
|
||||
@@ -2250,7 +2265,7 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
item.setCharacterSet(this.exprParser.primary());
|
||||
if (lexer.token() == Token.COMMA) {
|
||||
lexer.nextToken();
|
||||
acceptIdentifier("COLLATE");
|
||||
acceptIdentifier(COLLATE2);
|
||||
accept(Token.EQ);
|
||||
item.setCollate(this.exprParser.primary());
|
||||
}
|
||||
|
||||
@@ -544,10 +544,10 @@ public class MySqlOutputVisitor extends SQLASTOutputVisitor implements MySqlASTV
|
||||
from.accept(this);
|
||||
}
|
||||
|
||||
SQLExpr _for = (SQLExpr) x.getAttribute("FOR");
|
||||
if (_for != null) {
|
||||
SQLExpr forExpr = (SQLExpr) x.getAttribute("FOR");
|
||||
if (forExpr != null) {
|
||||
print(" FOR ");
|
||||
_for.accept(this);
|
||||
forExpr.accept(this);
|
||||
}
|
||||
print(")");
|
||||
|
||||
|
||||
@@ -402,8 +402,8 @@ public class OracleExprParser extends SQLExprParser {
|
||||
}
|
||||
|
||||
if (identifierEquals("AT")) {
|
||||
char mark_ch = lexer.current();
|
||||
int mark_bp = lexer.bp();
|
||||
char markChar = lexer.current();
|
||||
int markBp = lexer.bp();
|
||||
lexer.nextToken();
|
||||
if (lexer.token() == Token.LOCAL) {
|
||||
lexer.nextToken();
|
||||
@@ -412,7 +412,7 @@ public class OracleExprParser extends SQLExprParser {
|
||||
if (identifierEquals("TIME")) {
|
||||
lexer.nextToken();
|
||||
} else {
|
||||
lexer.reset(mark_bp, mark_ch, Token.IDENTIFIER);
|
||||
lexer.reset(markBp, markChar, Token.IDENTIFIER);
|
||||
return expr;
|
||||
}
|
||||
acceptIdentifier("ZONE");
|
||||
|
||||
@@ -499,20 +499,20 @@ public class SQLExprParser extends SQLParser {
|
||||
}
|
||||
|
||||
if (expr instanceof SQLName || expr instanceof SQLDefaultExpr) {
|
||||
String method_name;
|
||||
String methodName;
|
||||
|
||||
SQLMethodInvokeExpr methodInvokeExpr;
|
||||
if (expr instanceof SQLPropertyExpr) {
|
||||
method_name = ((SQLPropertyExpr) expr).getName();
|
||||
methodInvokeExpr = new SQLMethodInvokeExpr(method_name);
|
||||
methodName = ((SQLPropertyExpr) expr).getName();
|
||||
methodInvokeExpr = new SQLMethodInvokeExpr(methodName);
|
||||
methodInvokeExpr.setOwner(((SQLPropertyExpr) expr).getOwner());
|
||||
} else {
|
||||
method_name = expr.toString();
|
||||
methodInvokeExpr = new SQLMethodInvokeExpr(method_name);
|
||||
methodName = expr.toString();
|
||||
methodInvokeExpr = new SQLMethodInvokeExpr(methodName);
|
||||
}
|
||||
|
||||
if (isAggreateFunction(method_name)) {
|
||||
SQLAggregateExpr aggregateExpr = parseAggregateExpr(method_name);
|
||||
if (isAggreateFunction(methodName)) {
|
||||
SQLAggregateExpr aggregateExpr = parseAggregateExpr(methodName);
|
||||
|
||||
return aggregateExpr;
|
||||
}
|
||||
@@ -664,10 +664,10 @@ public class SQLExprParser extends SQLParser {
|
||||
}
|
||||
|
||||
public boolean isAggreateFunction(String word) {
|
||||
String[] _aggregateFunctions = { "AVG", "COUNT", "MAX", "MIN", "STDDEV", "SUM" };
|
||||
String[] aggregateFunctions = { "AVG", "COUNT", "MAX", "MIN", "STDDEV", "SUM" };
|
||||
|
||||
for (int i = 0; i < _aggregateFunctions.length; ++i) {
|
||||
if (_aggregateFunctions[i].compareToIgnoreCase(word) == 0) {
|
||||
for (int i = 0; i < aggregateFunctions.length; ++i) {
|
||||
if (aggregateFunctions[i].compareToIgnoreCase(word) == 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -201,11 +201,11 @@ public class SQLStatementParser extends SQLParser {
|
||||
}
|
||||
|
||||
if (lexer.token() == Token.LPAREN) {
|
||||
char mark_ch = lexer.current();
|
||||
int mark_bp = lexer.bp();
|
||||
char markChar = lexer.current();
|
||||
int markBp = lexer.bp();
|
||||
lexer.nextToken();
|
||||
if (lexer.token() == Token.SELECT) {
|
||||
lexer.reset(mark_bp, mark_ch, Token.LPAREN);
|
||||
lexer.reset(markBp, markChar, Token.LPAREN);
|
||||
SQLStatement stmt = parseSelect();
|
||||
statementList.add(stmt);
|
||||
continue;
|
||||
@@ -471,8 +471,8 @@ public class SQLStatementParser extends SQLParser {
|
||||
}
|
||||
|
||||
public SQLStatement parseCreate() {
|
||||
char mark_ch = lexer.current();
|
||||
int mark_bp = lexer.bp();
|
||||
char markChar = lexer.current();
|
||||
int markBp = lexer.bp();
|
||||
|
||||
accept(Token.CREATE);
|
||||
|
||||
@@ -489,7 +489,7 @@ public class SQLStatementParser extends SQLParser {
|
||||
lexer.nextToken();
|
||||
acceptIdentifier("REPLACE");
|
||||
if (lexer.token() == Token.PROCEDURE) {
|
||||
lexer.reset(mark_bp, mark_ch, Token.CREATE);
|
||||
lexer.reset(markBp, markChar, Token.CREATE);
|
||||
return parseCreateProcedure();
|
||||
}
|
||||
|
||||
|
||||
@@ -299,7 +299,7 @@ public class SQLEvalVisitorUtils {
|
||||
try {
|
||||
return new SimpleDateFormat(format).parse(text);
|
||||
} catch (ParseException e) {
|
||||
throw new DruidRuntimeException("format : " + format + ", value : " + text);
|
||||
throw new DruidRuntimeException("format : " + format + ", value : " + text, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -201,9 +201,9 @@ public class StatViewServlet extends HttpServlet {
|
||||
}
|
||||
|
||||
if ("/submitLogin".equals(path)) {
|
||||
String _username = request.getParameter(PARAM_NAME_USERNAME);
|
||||
String _password = request.getParameter(PARAM_NAME_PASSWORD);
|
||||
if (username.equals(_username) && password.equals(_password)) {
|
||||
String usernameParam = request.getParameter(PARAM_NAME_USERNAME);
|
||||
String passwordParam = request.getParameter(PARAM_NAME_PASSWORD);
|
||||
if (username.equals(usernameParam) && password.equals(passwordParam)) {
|
||||
request.getSession().setAttribute(SESSION_USER_KEY, username);
|
||||
response.getWriter().print("success");
|
||||
} else {
|
||||
|
||||
@@ -581,7 +581,7 @@ public class WebAppStat {
|
||||
}
|
||||
|
||||
boolean isIE = userAgent.startsWith("MSIE", MOZILLA_COMPATIBLE_OFFSET);
|
||||
int ie_prefix_index = 30; // "Mozilla/5.0 (compatible; MSIE ".length();
|
||||
int iePrefixIndex = 30; // "Mozilla/5.0 (compatible; MSIE ".length();
|
||||
|
||||
boolean isGoogleToolbar = false;
|
||||
|
||||
@@ -592,7 +592,7 @@ public class WebAppStat {
|
||||
int tmp = userAgent.indexOf("IE ");
|
||||
if (tmp != -1) {
|
||||
isIE = true;
|
||||
ie_prefix_index = tmp + 3;
|
||||
iePrefixIndex = tmp + 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -602,11 +602,11 @@ public class WebAppStat {
|
||||
browserIECount.incrementAndGet();
|
||||
|
||||
char v1 = ' ', v2 = ' ';
|
||||
if (userAgent.length() > ie_prefix_index + 1) {
|
||||
v1 = userAgent.charAt(ie_prefix_index);
|
||||
v2 = userAgent.charAt(ie_prefix_index + 1);
|
||||
} else if (userAgent.length() > ie_prefix_index) {
|
||||
v1 = userAgent.charAt(ie_prefix_index);
|
||||
if (userAgent.length() > iePrefixIndex + 1) {
|
||||
v1 = userAgent.charAt(iePrefixIndex);
|
||||
v2 = userAgent.charAt(iePrefixIndex + 1);
|
||||
} else if (userAgent.length() > iePrefixIndex) {
|
||||
v1 = userAgent.charAt(iePrefixIndex);
|
||||
}
|
||||
|
||||
switch (v1) {
|
||||
|
||||
@@ -262,9 +262,9 @@ public class IPAddress implements Cloneable {
|
||||
throw new IllegalArgumentException("Invalid IP Address [" + ipAddressStr + "]");
|
||||
}
|
||||
} catch (NoSuchElementException ex) {
|
||||
throw new IllegalArgumentException("Invalid IP Address [" + ipAddressStr + "]");
|
||||
throw new IllegalArgumentException("Invalid IP Address [" + ipAddressStr + "]", ex);
|
||||
} catch (NumberFormatException ex) {
|
||||
throw new IllegalArgumentException("Invalid IP Address [" + ipAddressStr + "]");
|
||||
throw new IllegalArgumentException("Invalid IP Address [" + ipAddressStr + "]", ex);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
@@ -226,7 +226,7 @@ public class IPRange {
|
||||
// create the corresponding subnet decimal
|
||||
extendedNetworkPrefix = computeNetworkPrefixFromMask(ipSubnetMask);
|
||||
if (extendedNetworkPrefix == -1) {
|
||||
throw new IllegalArgumentException("Invalid IP range [" + range + "]");
|
||||
throw new IllegalArgumentException("Invalid IP range [" + range + "]", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user