[jboss-cvs] JBossAS SVN: r64203 - in projects/aop/trunk/aop/src: test/org/jboss/test/aop/beforeafterthrowingscoped and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Jul 23 14:26:43 EDT 2007
Author: flavia.rainone at jboss.com
Date: 2007-07-23 14:26:43 -0400 (Mon, 23 Jul 2007)
New Revision: 64203
Modified:
projects/aop/trunk/aop/src/main/org/jboss/aop/instrument/JoinPointGenerator.java
projects/aop/trunk/aop/src/test/org/jboss/test/aop/beforeafterthrowingscoped/CallerJoinpointScopedTestCase.java
Log:
[JBAOP-444] Bug solved.
Modified: projects/aop/trunk/aop/src/main/org/jboss/aop/instrument/JoinPointGenerator.java
===================================================================
--- projects/aop/trunk/aop/src/main/org/jboss/aop/instrument/JoinPointGenerator.java 2007-07-23 18:24:47 UTC (rev 64202)
+++ projects/aop/trunk/aop/src/main/org/jboss/aop/instrument/JoinPointGenerator.java 2007-07-23 18:26:43 UTC (rev 64203)
@@ -468,10 +468,11 @@
return;
}
- while (advisorSuperClazz != null && advisorSuperClazz.getDeclaringClass() != info.getClazz())
- {
- advisorSuperClazz = advisorSuperClazz.getSuperclass();
- }
+ //while (advisorSuperClazz != null && advisorSuperClazz.getDeclaringClass() != info.getClazz())
+ //{
+ // advisorSuperClazz = advisorSuperClazz.getSuperclass();
+ //}
+ advisorSuperClazz = AspectManager.instance().getAdvisor(info.getClazz()).getClass();
try
{
try
@@ -757,10 +758,7 @@
return;
}
- //caller should always come before the target in the list for invokeJoinPoint(), if using
- //a caller pointcut the instanceadvisor is the caller's, so it should be a safe assumption
- //to always use $1
- String instanceAdvisor = "$1";
+ String instanceAdvisor = "$" + parameters.getContextIndex();
code.append("if (!" + INITIALISED_LIGHTWEIGHT_INSTANCE_ASPECTS + "){");
code.append(" if(" + IS_FOR_INSTANCE_ADVISOR + "){");
@@ -2001,6 +1999,22 @@
return callerIndex;
}
+ /**
+ * Returns the index of the joinpoint context (the context where the
+ * intercepted joinpoint is executed). For caller joinpoints, the
+ * context is the caller; for other joinpoints, the context of the joinpoint is
+ * the target.
+ *
+ * This method must be called only for per instance situations, i.e, situations
+ * where there is a context available.
+ *
+ * @return the index of the joinpoint context
+ */
+ public final int getContextIndex()
+ {
+ return caller? callerIndex: targetIndex;
+ }
+
public final int getFirstArgIndex()
{
return firstArgIndex;
Modified: projects/aop/trunk/aop/src/test/org/jboss/test/aop/beforeafterthrowingscoped/CallerJoinpointScopedTestCase.java
===================================================================
--- projects/aop/trunk/aop/src/test/org/jboss/test/aop/beforeafterthrowingscoped/CallerJoinpointScopedTestCase.java 2007-07-23 18:24:47 UTC (rev 64202)
+++ projects/aop/trunk/aop/src/test/org/jboss/test/aop/beforeafterthrowingscoped/CallerJoinpointScopedTestCase.java 2007-07-23 18:26:43 UTC (rev 64203)
@@ -62,13 +62,13 @@
}
// TODO JBAOP-444
-// public void testMethodCall() throws ThrownByTestException
-// {
-// for (int i = 0; i < 10; i++)
-// {
-// performCall(CallAction.CALL_METHOD);
-// }
-// }
+ public void testMethodCall() throws ThrownByTestException
+ {
+ for (int i = 0; i < 10; i++)
+ {
+ performCall(CallAction.CALL_METHOD);
+ }
+ }
public void testStaticMethodCall() throws ThrownByTestException
{
More information about the jboss-cvs-commits
mailing list