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:
committed by
Brian Clozel
parent
cd3ac44fb0
commit
0d4dfb6c1f
@@ -158,8 +158,7 @@ class AdvisorAutoProxyCreatorIntegrationTests {
|
||||
try {
|
||||
rb.echoException(new ServletException());
|
||||
}
|
||||
catch (ServletException ex) {
|
||||
|
||||
catch (ServletException ignored) {
|
||||
}
|
||||
assertThat(txMan.commits).as("Transaction counts match").isEqualTo(1);
|
||||
}
|
||||
@@ -272,7 +271,7 @@ class OrderedTxCheckAdvisor extends StaticMethodMatcherPointcutAdvisor implement
|
||||
TransactionInterceptor.currentTransactionStatus();
|
||||
throw new RuntimeException("Shouldn't have a transaction");
|
||||
}
|
||||
catch (NoTransactionException ex) {
|
||||
catch (NoTransactionException ignored) {
|
||||
// this is Ok
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user