Skip to content

Commit 97ea22c

Browse files
committed
Defensively catch any exception from match attempts (for compatibility with AspectJ 1.8.10)
Issue: SPR-15019
1 parent f6b2a21 commit 97ea22c

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJExpressionPointcut.java

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
import org.aopalliance.intercept.MethodInvocation;
2929
import org.apache.commons.logging.Log;
3030
import org.apache.commons.logging.LogFactory;
31-
import org.aspectj.weaver.BCException;
3231
import org.aspectj.weaver.patterns.NamePattern;
3332
import org.aspectj.weaver.reflect.ReflectionWorld.ReflectionWorldException;
3433
import org.aspectj.weaver.reflect.ShadowMatchImpl;
@@ -259,11 +258,7 @@ public boolean matches(Class<?> targetClass) {
259258
}
260259
}
261260
}
262-
catch (BCException ex) {
263-
logger.debug("PointcutExpression matching rejected target class", ex);
264-
}
265-
catch (IllegalStateException ex) {
266-
// AspectJ 1.8.10: encountered invalid signature
261+
catch (Throwable ex) {
267262
logger.debug("PointcutExpression matching rejected target class", ex);
268263
}
269264
return false;
@@ -331,7 +326,6 @@ public boolean matches(Method method, Class<?> targetClass, Object... args) {
331326
}
332327
catch (IllegalStateException ex) {
333328
// No current invocation...
334-
// TODO: Should we really proceed here?
335329
if (logger.isDebugEnabled()) {
336330
logger.debug("Could not access current invocation - matching with limited context: " + ex);
337331
}
@@ -454,8 +448,8 @@ private ShadowMatch getShadowMatch(Method targetMethod, Method originalMethod) {
454448
}
455449
}
456450
}
457-
catch (IllegalStateException ex) {
458-
// AspectJ 1.8.10: encountered invalid signature
451+
catch (Throwable ex) {
452+
// Possibly AspectJ 1.8.10 encountering an invalid signature
459453
logger.debug("PointcutExpression matching rejected target method", ex);
460454
fallbackExpression = null;
461455
}

0 commit comments

Comments
 (0)