Skip to content

Commit 935671a

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

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

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

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2015 the original author or authors.
2+
* Copyright 2002-2016 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -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;
@@ -258,11 +257,7 @@ public boolean matches(Class<?> targetClass) {
258257
}
259258
}
260259
}
261-
catch (BCException ex) {
262-
logger.debug("PointcutExpression matching rejected target class", ex);
263-
}
264-
catch (IllegalStateException ex) {
265-
// AspectJ 1.8.10: encountered invalid signature
260+
catch (Throwable ex) {
266261
logger.debug("PointcutExpression matching rejected target class", ex);
267262
}
268263
return false;
@@ -330,7 +325,6 @@ public boolean matches(Method method, Class<?> targetClass, Object... args) {
330325
}
331326
catch (IllegalStateException ex) {
332327
// No current invocation...
333-
// TODO: Should we really proceed here?
334328
if (logger.isDebugEnabled()) {
335329
logger.debug("Could not access current invocation - matching with limited context: " + ex);
336330
}
@@ -453,8 +447,8 @@ private ShadowMatch getShadowMatch(Method targetMethod, Method originalMethod) {
453447
}
454448
}
455449
}
456-
catch (IllegalStateException ex) {
457-
// AspectJ 1.8.10: encountered invalid signature
450+
catch (Throwable ex) {
451+
// Possibly AspectJ 1.8.10 encountering an invalid signature
458452
logger.debug("PointcutExpression matching rejected target method", ex);
459453
fallbackExpression = null;
460454
}

0 commit comments

Comments
 (0)