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:
@@ -178,12 +178,6 @@ public class Lexer {
|
||||
token = ERROR;
|
||||
}
|
||||
|
||||
/**
|
||||
* Report an error at the current token position using the provided arguments.
|
||||
*/
|
||||
private void lexError(String key, Object... args) {
|
||||
lexError(tokenPos, key, args);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the current token, set by nextToken().
|
||||
@@ -376,7 +370,7 @@ public class Lexer {
|
||||
token = EOF;
|
||||
tokenPos = bp = eofPos;
|
||||
} else {
|
||||
lexError("illegal.char", String.valueOf((int) ch));
|
||||
lexError(tokenPos, "illegal.char", String.valueOf((int) ch));
|
||||
scanChar();
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ public class SQLParser {
|
||||
}
|
||||
}
|
||||
|
||||
protected String as() throws ParserException {
|
||||
protected String as() {
|
||||
String alias = null;
|
||||
|
||||
if (lexer.token() == Token.AS) {
|
||||
|
||||
@@ -46,7 +46,7 @@ public class SQLSelectParser extends SQLParser {
|
||||
this.exprParser = exprParser;
|
||||
}
|
||||
|
||||
public SQLSelect select() throws ParserException {
|
||||
public SQLSelect select() {
|
||||
SQLSelect select = new SQLSelect();
|
||||
|
||||
select.setQuery(query());
|
||||
@@ -72,7 +72,7 @@ public class SQLSelectParser extends SQLParser {
|
||||
return union;
|
||||
}
|
||||
|
||||
public SQLSelectQuery queryRest(SQLSelectQuery selectQuery) throws ParserException {
|
||||
public SQLSelectQuery queryRest(SQLSelectQuery selectQuery) {
|
||||
if (lexer.token() == Token.UNION) {
|
||||
lexer.nextToken();
|
||||
|
||||
@@ -123,7 +123,7 @@ public class SQLSelectParser extends SQLParser {
|
||||
return selectQuery;
|
||||
}
|
||||
|
||||
public SQLSelectQuery query() throws ParserException {
|
||||
public SQLSelectQuery query() {
|
||||
if (lexer.token() == Token.LPAREN) {
|
||||
lexer.nextToken();
|
||||
|
||||
@@ -159,7 +159,7 @@ public class SQLSelectParser extends SQLParser {
|
||||
return queryRest(queryBlock);
|
||||
}
|
||||
|
||||
protected void parseWhere(SQLSelectQueryBlock queryBlock) throws ParserException {
|
||||
protected void parseWhere(SQLSelectQueryBlock queryBlock) {
|
||||
if (lexer.token() == Token.WHERE) {
|
||||
lexer.nextToken();
|
||||
|
||||
@@ -167,7 +167,7 @@ public class SQLSelectParser extends SQLParser {
|
||||
}
|
||||
}
|
||||
|
||||
protected void parseGroupBy(SQLSelectQueryBlock queryBlock) throws ParserException {
|
||||
protected void parseGroupBy(SQLSelectQueryBlock queryBlock) {
|
||||
if (lexer.token() == Token.GROUP) {
|
||||
lexer.nextToken();
|
||||
accept(Token.BY);
|
||||
@@ -198,7 +198,7 @@ public class SQLSelectParser extends SQLParser {
|
||||
}
|
||||
}
|
||||
|
||||
protected void parseSelectList(SQLSelectQueryBlock queryBlock) throws ParserException {
|
||||
protected void parseSelectList(SQLSelectQueryBlock queryBlock) {
|
||||
queryBlock.getSelectList().add(new SQLSelectItem(expr(), as()));
|
||||
|
||||
while (lexer.token() == Token.COMMA) {
|
||||
@@ -207,7 +207,7 @@ public class SQLSelectParser extends SQLParser {
|
||||
}
|
||||
}
|
||||
|
||||
public void parseFrom(SQLSelectQueryBlock queryBlock) throws ParserException {
|
||||
public void parseFrom(SQLSelectQueryBlock queryBlock) {
|
||||
if (lexer.token() != Token.FROM) {
|
||||
return;
|
||||
}
|
||||
@@ -217,7 +217,7 @@ public class SQLSelectParser extends SQLParser {
|
||||
queryBlock.setFrom(parseTableSource());
|
||||
}
|
||||
|
||||
public SQLTableSource parseTableSource() throws ParserException {
|
||||
public SQLTableSource parseTableSource() {
|
||||
if (lexer.token() == Token.LPAREN) {
|
||||
lexer.nextToken();
|
||||
SQLTableSource tableSource;
|
||||
@@ -248,7 +248,7 @@ public class SQLSelectParser extends SQLParser {
|
||||
return parseTableSourceRest(tableReference);
|
||||
}
|
||||
|
||||
private void parseTableSourceQueryTableExpr(SQLExprTableSource tableReference) throws ParserException {
|
||||
private void parseTableSourceQueryTableExpr(SQLExprTableSource tableReference) {
|
||||
if (lexer.token() == Token.LITERAL_ALIAS || lexer.token() == Token.IDENTIFIED
|
||||
|| lexer.token() == Token.LITERAL_CHARS) {
|
||||
tableReference.setExpr(this.exprParser.name());
|
||||
@@ -258,7 +258,7 @@ public class SQLSelectParser extends SQLParser {
|
||||
tableReference.setExpr(expr());
|
||||
}
|
||||
|
||||
protected SQLTableSource parseTableSourceRest(SQLTableSource tableSource) throws ParserException {
|
||||
protected SQLTableSource parseTableSourceRest(SQLTableSource tableSource) {
|
||||
if ((tableSource.getAlias() == null) || (tableSource.getAlias().length() == 0)) {
|
||||
if (lexer.token() != Token.LEFT && lexer.token() != Token.RIGHT && lexer.token() != Token.FULL) {
|
||||
String alias = as();
|
||||
@@ -329,7 +329,7 @@ public class SQLSelectParser extends SQLParser {
|
||||
return this.exprParser.expr();
|
||||
}
|
||||
|
||||
public SQLOrderBy parseOrderBy() throws ParserException {
|
||||
public SQLOrderBy parseOrderBy() {
|
||||
return this.exprParser.parseOrderBy();
|
||||
}
|
||||
|
||||
|
||||
@@ -63,13 +63,13 @@ public class SQLStatementParser extends SQLParser {
|
||||
return exprParser;
|
||||
}
|
||||
|
||||
public List<SQLStatement> parseStatementList() throws ParserException {
|
||||
public List<SQLStatement> parseStatementList() {
|
||||
List<SQLStatement> statementList = new ArrayList<SQLStatement>();
|
||||
parseStatementList(statementList);
|
||||
return statementList;
|
||||
}
|
||||
|
||||
public void parseStatementList(List<SQLStatement> statementList) throws ParserException {
|
||||
public void parseStatementList(List<SQLStatement> statementList) {
|
||||
for (;;) {
|
||||
if (lexer.token() == Token.EOF) {
|
||||
return;
|
||||
@@ -408,11 +408,11 @@ public class SQLStatementParser extends SQLParser {
|
||||
return false;
|
||||
}
|
||||
|
||||
public SQLStatement parseDropUser() throws ParserException {
|
||||
public SQLStatement parseDropUser() {
|
||||
throw new ParserException("TODO " + lexer.token());
|
||||
}
|
||||
|
||||
public SQLStatement parseDropIndex() throws ParserException {
|
||||
public SQLStatement parseDropIndex() {
|
||||
accept(Token.INDEX);
|
||||
SQLDropIndexStatement stmt = new SQLDropIndexStatement();
|
||||
stmt.setIndexName(this.exprParser.name());
|
||||
@@ -421,7 +421,7 @@ public class SQLStatementParser extends SQLParser {
|
||||
return stmt;
|
||||
}
|
||||
|
||||
public SQLCallStatement parseCall() throws ParserException {
|
||||
public SQLCallStatement parseCall() {
|
||||
|
||||
boolean brace = false;
|
||||
if (lexer.token() == Token.LBRACE) {
|
||||
@@ -447,7 +447,7 @@ public class SQLStatementParser extends SQLParser {
|
||||
return stmt;
|
||||
}
|
||||
|
||||
public SQLStatement parseSet() throws ParserException {
|
||||
public SQLStatement parseSet() {
|
||||
accept(Token.SET);
|
||||
SQLSetStatement stmt = new SQLSetStatement();
|
||||
|
||||
@@ -470,7 +470,7 @@ public class SQLStatementParser extends SQLParser {
|
||||
}
|
||||
}
|
||||
|
||||
public SQLStatement parseCreate() throws ParserException {
|
||||
public SQLStatement parseCreate() {
|
||||
char mark_ch = lexer.current();
|
||||
int mark_bp = lexer.bp();
|
||||
|
||||
@@ -530,7 +530,7 @@ public class SQLStatementParser extends SQLParser {
|
||||
return new SQLCreateTableParser(this.exprParser);
|
||||
}
|
||||
|
||||
public SQLSelectStatement parseSelect() throws ParserException {
|
||||
public SQLSelectStatement parseSelect() {
|
||||
return new SQLSelectStatement(createSQLSelectParser().select());
|
||||
}
|
||||
|
||||
@@ -538,7 +538,7 @@ public class SQLStatementParser extends SQLParser {
|
||||
return new SQLSelectParser(this.exprParser);
|
||||
}
|
||||
|
||||
public SQLUpdateStatement parseUpdateStatement() throws ParserException {
|
||||
public SQLUpdateStatement parseUpdateStatement() {
|
||||
SQLUpdateStatement udpateStatement = createUpdateStatement();
|
||||
|
||||
if (lexer.token() == Token.UPDATE) {
|
||||
@@ -578,7 +578,7 @@ public class SQLStatementParser extends SQLParser {
|
||||
return new SQLUpdateStatement();
|
||||
}
|
||||
|
||||
public SQLDeleteStatement parseDeleteStatement() throws ParserException {
|
||||
public SQLDeleteStatement parseDeleteStatement() {
|
||||
SQLDeleteStatement deleteStatement = new SQLDeleteStatement();
|
||||
|
||||
if (lexer.token() == Token.DELETE) {
|
||||
@@ -601,13 +601,13 @@ public class SQLStatementParser extends SQLParser {
|
||||
return deleteStatement;
|
||||
}
|
||||
|
||||
public SQLCreateTableStatement parseCreateTable() throws ParserException {
|
||||
public SQLCreateTableStatement parseCreateTable() {
|
||||
// SQLCreateTableParser parser = new SQLCreateTableParser(this.lexer);
|
||||
// return parser.parseCrateTable();
|
||||
throw new ParserException("TODO");
|
||||
}
|
||||
|
||||
public SQLCreateViewStatement parseCreateView() throws ParserException {
|
||||
public SQLCreateViewStatement parseCreateView() {
|
||||
SQLCreateViewStatement createView = new SQLCreateViewStatement();
|
||||
|
||||
this.accept(Token.CREATE);
|
||||
|
||||
Reference in New Issue
Block a user