Re: [aspectwerkz-user] can we use Exception class to handle all types of Exceptions
Alexandru Popescu <[email protected]>
| Newsgroups | gmane.comp.java.aspectwerkz.user |
|---|---|
| Message-ID | <[email protected]> |
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 [quote Ravi Kumar::on 3/18/2005 2:05 PM] > ---------- Forwarded message ---------- > From: Ravi Kumar <[email protected]> > Date: Fri, 18 Mar 2005 17:33:50 +0530 > Subject: can we use Exception class to handle all types of Exceptions > To: [email protected] > > > hi all, > > i am going to write Exception Aspect which has to handle all the > different types of Exceptions like > SQLException,NullPointerException...etc > > so for that to achieve can i use the below tag in the aop.xml configuration tag > > <aspect class="ExceptionHandlingAspect"> > <pointcut name="AllException" > expression="handler(java.sql.Exception+) "/> > <advice name="getException" type="before" > bind-to="AllException" /> > </aspect> > > so that it will handle all the classes in the entrie package. > > and in the aspect class i will check the Exception type by using " instanaof " > > is it the right way ...? > > waiting for ur reply > > with regards > ravi kumar > Probably it would be better to restrict your pointcut to your project packages (using maybe within() or by specifying in aop.xml an include element. - -- :alex |.::the_mindstorm::.| -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (MingW32) iD8DBQFCOsYCOCPjdDT2FEURAmCmAKCS9lOciTFYrSzdjK8t7/WHbu8cqQCgnA6c 4Tvs7utsCkene4qnKMmjaXI= =lOdm -----END PGP SIGNATURE-----