From 97ea22cb4a29b3ec683b39d8dbf5c550fb980f30 Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Tue, 20 Dec 2016 12:17:51 +0100 Subject: [PATCH] Defensively catch any exception from match attempts (for compatibility with AspectJ 1.8.10) Issue: SPR-15019 --- .../aop/aspectj/AspectJExpressionPointcut.java | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJExpressionPointcut.java b/spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJExpressionPointcut.java index c2f7c0e328..6d3629b10f 100644 --- a/spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJExpressionPointcut.java +++ b/spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJExpressionPointcut.java @@ -28,7 +28,6 @@ import java.util.concurrent.ConcurrentHashMap; import org.aopalliance.intercept.MethodInvocation; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.aspectj.weaver.BCException; import org.aspectj.weaver.patterns.NamePattern; import org.aspectj.weaver.reflect.ReflectionWorld.ReflectionWorldException; import org.aspectj.weaver.reflect.ShadowMatchImpl; @@ -259,11 +258,7 @@ public class AspectJExpressionPointcut extends AbstractExpressionPointcut } } } - catch (BCException ex) { - logger.debug("PointcutExpression matching rejected target class", ex); - } - catch (IllegalStateException ex) { - // AspectJ 1.8.10: encountered invalid signature + catch (Throwable ex) { logger.debug("PointcutExpression matching rejected target class", ex); } return false; @@ -331,7 +326,6 @@ public class AspectJExpressionPointcut extends AbstractExpressionPointcut } catch (IllegalStateException ex) { // No current invocation... - // TODO: Should we really proceed here? if (logger.isDebugEnabled()) { logger.debug("Could not access current invocation - matching with limited context: " + ex); } @@ -454,8 +448,8 @@ public class AspectJExpressionPointcut extends AbstractExpressionPointcut } } } - catch (IllegalStateException ex) { - // AspectJ 1.8.10: encountered invalid signature + catch (Throwable ex) { + // Possibly AspectJ 1.8.10 encountering an invalid signature logger.debug("PointcutExpression matching rejected target method", ex); fallbackExpression = null; }