Skip to content

Commit

Permalink
Catch exception
Browse files Browse the repository at this point in the history
  • Loading branch information
akrambek committed Dec 17, 2024
1 parent 11f3e09 commit 661a4bf
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -141,15 +141,21 @@ private void parser(
String sql,
PostgreSqlParserBaseListener listener)
{
sql = sql.replace("\u0000", "");

CharStream input = CharStreams.fromString(sql);
lexer.reset();
lexer.setInputStream(input);

tokens.setTokenSource(lexer);
parser.setTokenStream(tokens);

walker.walk(listener, parser.root());
try
{
sql = sql.replace("\u0000", "");

CharStream input = CharStreams.fromString(sql);
lexer.reset();
lexer.setInputStream(input);

tokens.setTokenSource(lexer);
parser.setTokenStream(tokens);

walker.walk(listener, parser.root());
}
catch (Exception ignore)
{
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,9 @@ private void doParseQuery(
.ifPresent(statement ->
{
String command = parser.parseCommand(statement);
final PgsqlTransform transform = clientTransforms.get(RisingwaveCommandType.valueOf(command.getBytes()));
final PgsqlTransform transform = command == null
? clientTransforms.get(RisingwaveCommandType.UNKNOWN_COMMAND)
: clientTransforms.get(RisingwaveCommandType.valueOf(command.getBytes()));
transform.transform(this, traceId, authorizationId, statement);
});
}
Expand Down

0 comments on commit 661a4bf

Please sign in to comment.