From 661a4bfe615fea6d73d09ec2d029b1c16a1457a5 Mon Sep 17 00:00:00 2001 From: Akram Yakubov Date: Tue, 17 Dec 2024 12:25:18 -0800 Subject: [PATCH] Catch exception --- .../binding/pgsql/parser/PgsqlParser.java | 26 ++++++++++++------- .../stream/RisingwaveProxyFactory.java | 4 ++- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/incubator/binding-pgsql/src/main/java/io/aklivity/zilla/runtime/binding/pgsql/parser/PgsqlParser.java b/incubator/binding-pgsql/src/main/java/io/aklivity/zilla/runtime/binding/pgsql/parser/PgsqlParser.java index f4712b31d6..4155dff887 100644 --- a/incubator/binding-pgsql/src/main/java/io/aklivity/zilla/runtime/binding/pgsql/parser/PgsqlParser.java +++ b/incubator/binding-pgsql/src/main/java/io/aklivity/zilla/runtime/binding/pgsql/parser/PgsqlParser.java @@ -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) + { + } } } diff --git a/incubator/binding-risingwave/src/main/java/io/aklivity/zilla/runtime/binding/risingwave/internal/stream/RisingwaveProxyFactory.java b/incubator/binding-risingwave/src/main/java/io/aklivity/zilla/runtime/binding/risingwave/internal/stream/RisingwaveProxyFactory.java index 2ca70503ea..52eccf9cf6 100644 --- a/incubator/binding-risingwave/src/main/java/io/aklivity/zilla/runtime/binding/risingwave/internal/stream/RisingwaveProxyFactory.java +++ b/incubator/binding-risingwave/src/main/java/io/aklivity/zilla/runtime/binding/risingwave/internal/stream/RisingwaveProxyFactory.java @@ -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); }); }