[jboss-jira] [JBoss JIRA] Created: (JBAOP-348) NPE on ConstructorCallMatcher
Flavia Rainone (JIRA)
jira-events at jboss.com
Thu Jan 18 18:52:53 EST 2007
NPE on ConstructorCallMatcher
-----------------------------
Key: JBAOP-348
URL: http://jira.jboss.com/jira/browse/JBAOP-348
Project: JBoss AOP
Issue Type: Bug
Security Level: Public (Everyone can see)
Affects Versions: 2.0.0.alpha2
Reporter: Flavia Rainone
Fix For: 2.0.0.alpha3
This bug happens on generated advsior instrumentation, in the following scenario:
- class A extends B
- B is advised by AOP
- A is not advised by AOP
- B calls constructor of A
- calls to A constructor are identified by a pointcut
During the instrumentation of a class B, the call to constructor of A is identified. As a consequence, during the matching process, A temporary advisor is required, through AspectManager.getTempClassAdvisorIfNotExist method. This method identifies A as advisable (since it extends an advisable class, B) and tries to retrieve its advisor instead of getting a temporary class advisor. Since A doesn't have the class advisor field, aspect manager retrieves its super class advisor. However, this value isn't set yet because we are still instrumenting B class. Hence, a null advisor is returned, what triggers the NullPointerException on ConstructorCallMatcher.
To reproduce this bug, it is enough to alter beforeafterArgs tests, by making TargetCallerPOJO a superclass of TargetCallerPOJO2.
The stack trace:
java.lang.ExceptionInInitializerError
at org.jboss.test.aop.beforeafterArgs.CallerTestCase.setUp(CallerTestCase.java:60)
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.NullPointerException
at org.jboss.aop.ClassAdvisor.doResolveCallerConstructorInfo(ClassAdvisor.java:1563)
at org.jboss.aop.ClassAdvisor.access$400(ClassAdvisor.java:83)
at org.jboss.aop.ClassAdvisor$ResolveCallerConstuctorInfoAction$1.run(ClassAdvisor.java:2028)
at java.security.AccessController.doPrivileged(Native Method)
at org.jboss.aop.ClassAdvisor$ResolveCallerConstuctorInfoAction$1 .resolveInfo(ClassAdvisor.java:2024)
at org.jboss.aop.ClassAdvisor.resolveCallerConstructorInfo(ClassAdvisor.java:1527)
at org.jboss.test.aop.beforeafterArgs.TargetCallerPOJO$TargetCallerPOJOAdvisor.initialiseCallers(TargetCallerPOJO$TargetCallerPOJOAdvisor.java)
at org.jboss.test.aop.beforeafterArgs.TargetCallerPOJO$TargetCallerPOJOAdvisor.initialise(TargetCallerPOJO$TargetCallerPOJOAdvisor.java)
at org.jboss.test.aop.beforeafterArgs.TargetCallerPOJO$TargetCallerPOJOAdvisor.<init>(TargetCallerPOJO$TargetCallerPOJOAdvisor.java)
at org.jboss.test.aop.beforeafterArgs.TargetCallerPOJO.<clinit>(TargetCallerPOJO.java)
... 13 more
Caused by: java.lang.RuntimeException:java.lang.NullPointerException
at org.jboss.aop.pointcut.ConstructorCallMatcher.visit(ConstructorCallMatcher.java:76)
at org.jboss.aop.pointcut.ast.ASTCall.jjtAccept(ASTCall.java:41)
at org.jboss.aop.pointcut.MatcherHelper.visit(MatcherHelper.java:89)
at org.jboss.aop.pointcut.MatcherHelper.matches(MatcherHelper.java:83)
at org.jboss.aop.pointcut.PointcutExpression.matchesCall(PointcutExpression.java:243)
at org.jboss.aop.ClassAdvisor.doResolveCallerConstructorInfo(ClassAdvisor.java:1548)
... 22 more
Caused by: java.lang.NullPointerException
at org.jboss.aop.pointcut.ConstructorMatcher.<init>(ConstructorMatcher.java:61)
at org.jboss.aop.pointcut.ConstructorCallMatcher.visit(ConstructorCallMatcher.java:71)
.. 27 more
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list