Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] How to get the exception obj from call to printStackTrace

I think that what you are looking for is something like:

pointcut(Throwable cause): call(* *.printStackTrace(..)) && target(cause);

not tested, but i think it should work.

./alex
--
.w( the_mindstorm )p.


On 3/28/06, Michelle Xue <mxue@xxxxxxxxxxxxxxxxxxx> wrote:
Hi,
 
I want to write a pointcut that whenever this is a call to Throwable.printStackTrace, I want to get the throwable and do something with it.  So I need to do something like this:
 
pointcut printStackTracePrintStream(PrintStream s, Throwable myObject):
  execution(void Throwable.printStackTrace(PrintStream)) && args(s) && this(myObject);
 
This won't work because I think it only weaves at the definition of printStackTrace, which is in JAVA codes, but I am only running ajc on my codes. If I replace "execution" with "call", my codes will get weaved, but the object I get is the class that's calling printStackTrace, but the throwable object. Can anyone help me?  Thanks!
 
Michelle
 
 

_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users




Back to the top