Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] help on pointcuts weaving

I think you missunderstand withincode.

withincode(public * InetAddress.getLocalHost(..));

This matches all joinpoints that are lexically (i.e. textually)
contained in the method body of InetAddress.getLocalHost(..). So no
wonder your pointcut does not match. You have to replace "public *
InetAddress.getLocalHost(..)" by the signature of the method that
holds the call "s.getInetAddress().getLocalHost();".

Eric

2008/6/25 Neeraja Maniyani <neeraja.maniyani@xxxxxxxxx>:
> hi,
>
> The call in the java class looks like this
>
> InetAddress testAddress = null;
> Socket s = new Socket(addr, 80);
> testAddress = s.getInetAddress().getLocalHost();
>
> I want the advice to weave in at this "s.getInetAddress().getLocalHost(); "
> point.
>
> The pointcut and advice with which i currently tested looks like this
>
> pointcut name2()
>   : call(public * Socket.getInetAddress(..)) && withincode(public *
> InetAddress.getLocalHost(..));
>
>
>   before() : name2() {
>    System.out.println("able to weave"); }
>
>
> I have tested using this call(public * Socket.getInetAddress..*(..)).
>
> But the advice dint get weaved in
>
> thank you.
>
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
>



-- 
Eric Bodden
Sable Research Group
McGill University, Montréal, Canada


Back to the top