Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Declare error

Ron,

you need to specify the return type of that method, e.g.,
call(* ILogger.logErrorMessage(..))

You might also find it useful to a declare error for printing:
get(* System.out) || get(* System.err) || call(* Throwable.printStackTrace())

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

> ------------Original Message-------------
> From: "DiFrango, Ron" <ron.difrango@xxxxxxxxxxxxxx>
> To: "'aspectj-users@xxxxxxxxxxx'" <aspectj-users@xxxxxxxxxxx>
> Date: Wed, Sep-10-2003 7:40 AM
> Subject: [aspectj-users] Declare error
> 
> All,
> 
> I am trying to enforce a standard that disallows calls to the exception
> logging mechanism in our framework.  The reasoning is that in the packages
> listed below, I already have a handler aspect that takes care of the logging
> for us.  So I created the following aspect:
> 
> public aspect DefaultExceptionHandlerAspect
> {
> 	pointcut classList() : 
> 		within(com.capitalone.risk.service.xml..*) ||
> 		within(com.capitalone.risk.service.data..*);
> 	
> 	/**
>         * ILogger is an interface class that all clients reference.
>         */	
> 	declare error
> 		: call(ILogger.logException(..)) && classList()
> 		: "Illegal Call to logException";
> 	
> 	/**
>         * ILogger is an interface class that all clients reference.
>         */	
> 	declare error
> 		: call(ILogger.logErrorMessage(..)) && classList()
> 		: "Illegal Call to logErrorMessage";
> }
> 
> When I apply the aspects I get the following error:
> 
>      [iajc]
> C:\view$\rdifrang_aspectjUpgrade_NT\discovery\dev\src\com\capitalone
> \aop\DefaultExceptionHandlerAspect.aj:35 Syntax error on token ".",
> "expected na
> me pattern" expected
>      [iajc] : call(ILogger.logException(..)) && classList()
>      [iajc]                             ^
>      [iajc]
> C:\view$\rdifrang_aspectjUpgrade_NT\discovery\dev\src\com\capitalone
> \aop\DefaultExceptionHandlerAspect.aj:39 Syntax error on token ".",
> "expected na
> me pattern" expected
>      [iajc] : call(ILogger.logErrorMessage(..)) && classList()
>      [iajc]                                ^
> 
> I have tried different variation but to no avail.  What am I doing wrong?
> 
> Thanks in advance,
> 
> Ron 
>  
> **************************************************************************
> The information transmitted herewith is sensitive information intended only
> for use by the individual or entity to which it is addressed. If the reader
> of this message is not the intended recipient, you are hereby notified that
> any review, retransmission, dissemination, distribution, copying or other
> use of, or taking of any action in reliance upon this information is
> strictly prohibited. If you have received this communication in error,
> please contact the sender and delete the material from your computer.
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> http://dev.eclipse.org/mailman/listinfo/aspectj-users
> 


Back to the top