Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] null thisJoinPointStaticPart when advising constructor execution

Hi All!

Could use some help here…

 

I'm tracing methods execution stemming from JUnit tests using AspectJ, using the following pointcut:

      pointcut methodUnderTestExecution() :

            execution(* *(..))

            && mutFilter();

 

before(): methodUnderTestExecution() {

            Signature sig = thisJoinPointStaticPart.getSignature();

                        …

So far, that works fine!

 

However, when trying to add constructor execution to the pointcut, I get some unexpected behaviors:

 

      pointcut methodUnderTestExecution1() :

            (execution(* *(..)) || execution(new(..)))

            && mutFilter();

 

before(): methodUnderTestExecution1() {

            Signature sig = thisJoinPointStaticPart.getSignature();

            // thisJoinPointStaticPart == null L

                        …

 

For some constructors in the application under test the advice causes NullPointerException because thisJoinPointStaticPart == null

 

Anyone?

 

 

Thanks,

Hagai


Back to the top