Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] LTW - advice being applied but code does not run

Hi,

 

I am trying to apply load-time weaving to a third-party application. The pointcut is as follows:

 

  pointcut createHttpSocket(String host, int port) :

    args(host, port) && execution(Socket HTTPSocketFactory.createSocket(..)) && !within(SocketFactorySwap);

 

The advice I am applying is as follows:

 

  Socket around(String host, int port) throws IOException: createHttpSocket(host, port)

  {

    System.out.println("Inside Advice - createHttpSocket");

    return new WrappedSocket(proceed(host, port));

  }

 

I enabled –showWeaveInfo and –debug. Here is what they tell me:

 

[WeavingURLClassLoader] debug weaving 'jade.mtp.http.HTTPSocketFactory'

[WeavingURLClassLoader] weaveinfo Join point 'method-execution(java.net.Socket jade.mtp.http.HTTPSocketFactory.createSocket(java.lang.String, int))' in Type 'jade.mtp.http.HTTPSocketFactory' (no debug info available) advised by around advice from 'com.cra.mantra.aspects.SocketFactorySwap' (SocketFactorySwap.aj:73)

[WeavingURLClassLoader] debug generating class 'jade.mtp.http.HTTPSocketFactory$AjcClosure1'

 

However, the code inside the advice does not actually execute. My println does not print, and my WrappedSocket constructor never gets touched. It’s strange to me that the weaver is acknowledging the match, applying the advice, and then ignoring the actual advice code.

 

I am running “AspectJ Weaver Version 1.6.0 built on Wednesday Apr 23, 2008 at 20:27:36 GMT”.

 

I could use some help, or advice, if you prefer, as I’m out of ideas.


Thanks,

Steve

 
 
 
 
THIS MESSAGE IS INTENDED FOR THE USE OF THE PERSON TO WHOM IT IS ADDRESSED. IT MAY CONTAIN INFORMATION THAT IS PRIVILEGED, CONFIDENTIAL AND EXEMPT FROM DISCLOSURE UNDER APPLICABLE LAW. If you are not the intended recipient, your use of this message for any purpose is strictly prohibited. If you have received this communication in error, please delete the message and notify the sender so that we may correct our records.
 
 
 

Back to the top