Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] getThis() caused stackoverflow



Sandro,

I presume that one or more of your classes defines a "toString()" method,
that's why you excluded them in the "traceMethods()" pointcut to avoid
recursion i.e. ->toString->Trace->getThis->toString->... However do any of
these "toString()" methods call another method in which case you _will_ get
recursion. In which case you need "&& !cflow(execution(String
*.toString()))".

Cheers

Matthew Webster
AOSD Project
Java Technology Centre, MP146
IBM Hursley Park, Winchester,  SO21 2JN, England
Telephone: +44 196 2816139 (external) 246139 (internal)
Email: Matthew Webster/UK/IBM @ IBMGB, matthew_webster@xxxxxxxxxx
http://w3.hursley.ibm.com/~websterm/

Sandro Ruch <sandro.ruch@xxxxxxxxxx>@eclipse.org on 19/01/2005 17:21:51

Please respond to aspectj-users@xxxxxxxxxxx

Sent by:    aspectj-users-admin@xxxxxxxxxxx


To:    aspectj-users@xxxxxxxxxxx
cc:
Subject:    Re: [aspectj-users] getThis() caused stackoverflow



in short... yes the error is still there... (i used System.out. instead)

sandro


                                                                           
 Matthew Webster                                                           
 <matthew_webster@xxxxxxxxxx>                                              
 Sent by:                                                               To 
 aspectj-users-admin@xxxxxxxxxxx               aspectj-users@xxxxxxxxxxx   
                                                                        cc 
                                                                           
 18.01.2005 18:07                                                  Subject 
                                               Re: [aspectj-users]         
                                               getThis() caused            
          Please respond to                    stackoverflow               
      aspectj-users@xxxxxxxxxxx                                            
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           









Sandro,

The import statement was missing from your code so I couldn't tell which
API you were using. The other reason I ask is that certain logging
frameworks do stack scanning (depending on configuration) to determine the
invoking class which could be the source of your problem. So the question
is does the call to getThis() cause the StackOverflowError or a subsequent
call to "info()"? If you just send the datat to stderr do you get the
error?

Matthew Webster
AOSD Project
Java Technology Centre, MP146
IBM Hursley Park, Winchester,  SO21 2JN, England
Telephone: +44 196 2816139 (external) 246139 (internal)
Email: Matthew Webster/UK/IBM @ IBMGB, matthew_webster@xxxxxxxxxx
http://w3.hursley.ibm.com/~websterm/

Sandro Ruch <sandro.ruch@xxxxxxxxxx>@eclipse.org on 18/01/2005 13:25:53

Please respond to aspectj-users@xxxxxxxxxxx

Sent by:    aspectj-users-admin@xxxxxxxxxxx


To:    aspectj-users@xxxxxxxxxxx
cc:
Subject:    Re: [aspectj-users] getThis() caused stackoverflow



>>        /** Logger named "ApplicationTracer" to log tracing data */
>>        private Logger logger =
LoggingFactory.getLogger("ApplicationTracer");

well, it depends on configuration which logging implementation is used...
in this case it is log4j...

i thought that the pointcut

>>        /**
>>         * Pointcut to match the scope in form of packages for the
advise.
>>         */
>>        pointcut traceClasses() :
>>                within(com.namics.common..*)
>>                && !within(com.namics.common.log*..*)
>>                && !within(com.namics.common.aop..*);

will reduce the scope correctly (only within com.namics.common.* but not
...)

are static mehtod that bad for getThis()?? i mean produce a
stackoverflow...?

kind regards,
sandro



Matthew Webster
<matthew_webster@xxxxxxxxxx>
Sent by:                                                               To
aspectj-users-admin@xxxxxxxxxxx               aspectj-users@xxxxxxxxxxx
                                                                       cc

18.01.2005 10:43                                                  Subject
                                              Re: [aspectj-users]
                                              getThis() caused
         Please respond to                    stackoverflow
     aspectj-users@xxxxxxxxxxx















Sandro,

Can I ask what logging implementation you are using? Also does your program
have static methods? In which case getThis() will return null. You may want
to check this or code separate advice for static methods.

Matthew Webster
AOSD Project
Java Technology Centre, MP146
IBM Hursley Park, Winchester,  SO21 2JN, England
Telephone: +44 196 2816139 (external) 246139 (internal)
Email: Matthew Webster/UK/IBM @ IBMGB, matthew_webster@xxxxxxxxxx
http://w3.hursley.ibm.com/~websterm/

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


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




Back to the top