Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Exception handling in aspects / RAD/Aspectj


Marco,

You may only throw checked exceptions in advice that are thrown by the advised join point. This isn't considered bad practice as you may refactor logic in a method that throws an exception into an aspect. I suspect the problem that you are seeing, which disappears with a full build, is related to incremental compilation.

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/



"Marco Mistroni" <mmistroni@xxxxxxxxx>
Sent by: aspectj-users-bounces@xxxxxxxxxxx

30/07/2006 10:40

Please respond to
aspectj-users@xxxxxxxxxxx

To
aspectj-users@xxxxxxxxxxx
cc
Subject
Re: [aspectj-users] Exception handling in aspects / RAD/Aspectj





hello fernando,
 yes it is... but i was wondering if in general it was a bad practice to raise exception from advices (even when  the intercepted method throws the same exception)..

thanx and regards
marco

On 7/29/06, Fernando Castor Filho <fernando.castor@xxxxxxxxx> wrote:
Marco,

Is MyException in the 'throws' clause of the intercepted method? If it
is not and MyException is a checked exception (does not inherit,
directly or indirectly, from RuntimeException), the compiler should
complain.

Regards,
Fernando

On 7/27/06, Marco Mistroni <
mmistroni@xxxxxxxxx> wrote:
> hi all,
>  i have a small issue.. i have written an aspect that intercepts certain
> methods which throw an exception of type
> MyException
>
> Now, in my advice if certain conditions are not met, i need to raise an
> exception..
>
> the question is: can i declare that exception in my advice?
>
> can ihave an advice like this
>
> before(MyStockDTO stockTrace) throws MyException
>
>
> is it bad practice?
>
> i m using it iwth AspectJ IN RAD, and every time i modify some code that has
> been woven before, RAD gets crazy and gives me an
> error like ' can't thrown checked exception MyException  at this join point
> method-call  ' ...
>
> weird thing is that the method intercepted is catching the exception .. and
> doing a 'clean' of the project will solve everything..
>
> anyone could comment pls?
>
> thanks and regards
>  marco
>
>
>
> _______________________________________________
> aspectj-users mailing list
>
aspectj-users@xxxxxxxxxxx
>
https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
>
>
_______________________________________________
aspectj-users mailing list

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


Back to the top