[jboss-user] [JBoss AOP] - Re: Constructor Execution Pointcut Causing ArrayOutOfBounds

Nicholas Whitehead do-not-reply at jboss.com
Sat Oct 2 10:03:34 EDT 2010


Nicholas Whitehead [http://community.jboss.org/people/nwhitehead] created the discussion

"Re: Constructor Execution Pointcut Causing ArrayOutOfBounds"

To view the discussion, visit: http://community.jboss.org/message/564667#564667

--------------------------------------------------------------
Hello Kabir;

Thanks for the response.

I hope the fact that no one is working on JBoss AOP right now is because it is complete and stable. Not being deprecated is it ?

After some more investigation and some simplified test cases, I have determined that the issue arises in this specific set of conditions:

1. An execution pointcut on private constructors.
2. An advised class that has a private parameterless constructor and one or more parameterized private constructors.

If the constructors are not private, or there is only a single private parameterless constructor, the error does not occur.

There are probably a number of other combinations of conditions, but I believe my patch should work for all for them and not break anything.

The issue is on line 1870 of *org.jboss.aop.Advisor* in JBoss AOP 2.1.8 GA. The line of code is:

*pointcutResolved(constructorInfos[i], binding, new ConstructorJoinpoint(constructor));*

My patch, which is very simplistic, replaces this line with:

*for(ConstructorInfo ci: constructorInfos) {
   if(constructor.equals(ci.getConstructor())) {
      pointcutResolved(ci, binding, new ConstructorJoinpoint(constructor));
      break;
   }
   throw new NotImplementedException(*
*        "Failed to match ConstructorInfo for Constructor [" + constructor.toGenericString() + "]");
 }*

The premise is that in this condition, the array of Constructors is not the same size as the array of ConstructorInfos, so we cannot use a simple index reference. Iterating through the available ConstructorInfos find the matching one and then executes the pointcutResolved normally. Not sure if the thrown exception is JBoss compliant, but I am also not sure if it will realistically ever reach that line anyways.

At any rate, let me know what I can do to submit this patch if you need something more formal.

Cheers.

//Nicholas
--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/564667#564667]

Start a new discussion in JBoss AOP at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2027]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20101002/b6c60152/attachment.html 


More information about the jboss-user mailing list