Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] How to deduce the method owning the catch statement referred by the handler join point?

You need to use thisEnclosingJoinPointStaticPart - another 'well
known' name like thisJoinPoint that will give you access to the
joinpoint enclosing your handler join point (i.e. the method
containing the catch block).

cheers,
Andy

On 10 December 2011 11:42, Mark <mark.kharitonov@xxxxxxxxx> wrote:
> I have the following advice code:
> =========================================================
>  pointcut caughtException(Exception e) : handler(Exception+) && args(e);
>  before (Exception e) : caughtException(e) && loggedScope() &&
> loggedMethodScope() {
>    logCaughtException(getLogger(thisJoinPointStaticPart), thisJoinPoint,
> e);
>  }
> =========================================================
>
> My wish is that the logCaughtException method output the name and the
> parameters of the method owning the adviced catch statement. However,
> thisJoinPoint.getSignature() returns a CatchClauseSignature instance, from
> which it is unclear to me how to extract the signature of the owning method.
>
> How can I do it?
>
> Thanks.
>
> --
> View this message in context: http://aspectj.2085585.n4.nabble.com/How-to-deduce-the-method-owning-the-catch-statement-referred-by-the-handler-join-point-tp4181004p4181004.html
> Sent from the AspectJ - users mailing list archive at Nabble.com.
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users


Back to the top