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