Rename exception variables in empty catch blocks

The Spring codebase sometimes ignores exceptions in catch blocks on
purpose. This is often called out by an inline comment.
We should make this more obvious by renaming the exception argument in
the catch block to declare whether the exception is "ignored" or
"expected".

See gh-35047

Signed-off-by: Vincent Potucek <vpotucek@me.com>
[brian.clozel@broadcom.com: rework commit message]
Signed-off-by: Brian Clozel <brian.clozel@broadcom.com>
This commit is contained in:
Vincent Potucek
2025-06-13 16:03:24 +02:00
committed by Brian Clozel
parent cd3ac44fb0
commit 0d4dfb6c1f
46 changed files with 66 additions and 108 deletions

View File

@@ -41,8 +41,7 @@ public class BinaryWebSocketHandler extends AbstractWebSocketHandler {
try {
session.close(CloseStatus.NOT_ACCEPTABLE.withReason("Text messages not supported"));
}
catch (IOException ex) {
// ignore
catch (IOException ignored) {
}
}

View File

@@ -93,8 +93,7 @@ public class ExceptionWebSocketHandlerDecorator extends WebSocketHandlerDecorato
try {
session.close(CloseStatus.SERVER_ERROR);
}
catch (Throwable ex) {
// ignore
catch (Throwable ignored) {
}
}
}

View File

@@ -41,8 +41,7 @@ public class TextWebSocketHandler extends AbstractWebSocketHandler {
try {
session.close(CloseStatus.NOT_ACCEPTABLE.withReason("Binary messages not supported"));
}
catch (IOException ex) {
// ignore
catch (IOException ignored) {
}
}

View File

@@ -412,8 +412,7 @@ public class StompSubProtocolHandler implements SubProtocolHandler, ApplicationE
try {
session.close(CloseStatus.PROTOCOL_ERROR);
}
catch (IOException ex) {
// Ignore
catch (IOException ignored) {
}
}
}