Configure CheckStyle rule for empty catch blocks

This commit configures a new CheckStyle rule that fails for empty
"catch" blocks, unless the exception is named "ignored" or "expected".

This also fixes the remaining instances missed by the previous commit.

Closes gh-35047
This commit is contained in:
Brian Clozel
2025-06-15 15:39:31 +02:00
parent 0d4dfb6c1f
commit af7758cbc7
8 changed files with 16 additions and 12 deletions

View File

@@ -453,9 +453,9 @@ public class AspectJExpressionPointcut extends AbstractExpressionPointcut
ClassUtils.toClassArray(ifcs), targetClass.getClassLoader());
targetMethod = ClassUtils.getMostSpecificMethod(targetMethod, compositeInterface);
}
// Implemented interfaces probably expose conflicting method signatures...
// Proceed with original target method.
catch (IllegalArgumentException ignored) {
catch (IllegalArgumentException ex) {
// Implemented interfaces probably expose conflicting method signatures...
// Proceed with original target method.
}
}
}
@@ -478,7 +478,7 @@ public class AspectJExpressionPointcut extends AbstractExpressionPointcut
try {
shadowMatch = pointcutExpression.matchesMethodExecution(methodToMatch);
}
catch (ReflectionWorldException ignored) {
catch (ReflectionWorldException ex) {
// Failed to introspect target method, probably because it has been loaded
// in a special ClassLoader. Let's try the declaring ClassLoader instead...
try {
@@ -501,7 +501,7 @@ public class AspectJExpressionPointcut extends AbstractExpressionPointcut
try {
shadowMatch = pointcutExpression.matchesMethodExecution(methodToMatch);
}
catch (ReflectionWorldException ignored) {
catch (ReflectionWorldException ex) {
// Could neither introspect the target class nor the proxy class ->
// let's try the original method's declaring class before we give up...
try {