[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Weaving Java Source Code - java.lang.StackOverflowError

Hi James,

Did you mean to write pointcut ThrowableInitializer(...) rather than constructor?

Can you post the *exact* test code that you'd *expect* to work for StackOverflowError but that doesn't? What is the code that does the "notification"? I suspect that there's something wrong with your pointcut definition (or your advice code!) for StackOverflowError but that you have it right for Throwable. Is this the code?

aspect VirtualMachineErrorHandler {
   pointcut constructor(java.lang.StackOverflowError t): 
       execution(new(..)) && target(t);
   before(java.lang.StackOverflowError t): constructor(t) {
      //notify SO Error - what goes here?

What happens if you try the same thing for your own user-defined exception that extends Throwable? that extends StackOverflowError? (i.e., advise the constructor execution of UserSOE, and write a test program that constructs one)?

When you are running in the debugger, if you step into the constructor init method, does it run the advice? For that matter, try using jdb to set a breakpoint in the advice code to see when it is running.

Ron Bodkin
Chief Technology Officer
New Aspects of Software
m: (415) 509-2895

------------Original Message------------
From: "James Calise" <jcalise@xxxxxxx>
To: <aspectj-users@xxxxxxxxxxx>
Date: Fri, Feb-6-2004 9:05 AM
Subject: Re: [aspectj-users] Weaving Java Source Code - java.lang.StackOverflowError
Thanks for the response Ron -  
Yes I realize that this is in violation of the Sun user agreement, but this is nothing for production use just an in house debugging mechanism.  I want to try to handle errors in the most generic way without weaving all my source code.   I ran the following aspect against 
Changing the target in each case.
aspect VirtualMachineErrorHandler {
    pintcut constructor(java.lang.Throwable t): execution(new(..)) && target(t);
   before(java.lang.Throwable t): ThrowableInitializer(t) {
   if (t instanceof java.lang.StackOverflowError) {
      //notify SO Error
Only in the Throwable case do I get the callback, eventhough via my debugger I can see when the call reaches <init> Throwable the init is called on SOE, and Error as well.
I wasn?t sure if I was doing something wrong or if anyone had insight on this that it is a VM implementation issue?