Skip to content

Commit

Permalink
Avoid catch Exception in Proxy codes (apache#26533)
Browse files Browse the repository at this point in the history
  • Loading branch information
TeslaCN authored Jul 2, 2023
1 parent 49a3d6d commit ec6cb96
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public void encode(final ChannelHandlerContext context, final DatabasePacket mes
try {
message.write(payload);
// CHECKSTYLE:OFF
} catch (final Exception ex) {
} catch (final RuntimeException ex) {
// CHECKSTYLE:ON
out.resetWriterIndex();
SQLException unknownSQLException = new UnknownSQLException(ex).toSQLException();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public void encode(final ChannelHandlerContext context, final DatabasePacket mes
try {
message.write(payload);
// CHECKSTYLE:OFF
} catch (final Exception ex) {
} catch (final RuntimeException ex) {
// CHECKSTYLE:ON
payload.getByteBuf().resetWriterIndex();
// TODO consider what severity to use
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public void encode(final ChannelHandlerContext context, final DatabasePacket mes
try {
message.write(payload);
// CHECKSTYLE:OFF
} catch (final Exception ex) {
} catch (final RuntimeException ex) {
// CHECKSTYLE:ON
payload.getByteBuf().resetWriterIndex();
// TODO consider what severity to use
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,7 @@ private Charset parseCharset(final String value) {
default:
try {
return Charset.forName(value);
// CHECKSTYLE:OFF
} catch (final Exception ex) {
// CHECKSTYLE:ON
} catch (final IllegalArgumentException ex) {
throw new UnknownCharsetException(value.toLowerCase());
}
}
Expand Down

0 comments on commit ec6cb96

Please sign in to comment.