[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: Re: [aspectj-users] Handling Exception while accesing Instance variable
|
Hi Eric,
For access thorugh the fields i was able to get it working with following pointcut (using FieldReference)
and having a around advice so that any exception thrown at access time will be wrapped.
pointcut handleObj() : get(com.lfg.edm.fileimport.domain..* *.*);
Object around() : handleObj( ) {
try {
return proceed();
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
Thanks,
Vinodh
On Wed, 16 Jul 2008 Eric Bodden wrote :
>Can you not use an around-advice? Something like...
>
>Object around(): myFiledSetPointcut() {
> try{
> return proceed();
> catch(RuntimeException e){
> //do whatever
> }
>}
>
>Eric
>
>2008/7/13 vinodh subbiah <vinodhts@xxxxxxxxxxxxxx>:
> > Hi All,
> > Im using Aspect J 1.5 and I need to write a pointcut to handle exceptions
> > while accessing .
> > So i come up with a point cut like one below
> > pointcut handle() : call( public * com.lfg.edm..*.get*(..));
> >
> > This one works fine if they call using the getter methods.
> >
> > Now if i have a method like
> > getX().getY().getZ();
> > All of these type of access are now handled with my pointcut
> > But can anyone help me to define the same pointcut when the user tries to
> > access the object like below
> >
> > Policy policy = x.y.z ;
> > Assume all the fields are public and so you can access with x.y.z.
> >
> > Thanks for your help in advance
> >
> > Vinodh Subbiah,
> > 580 Laforet Street,Apt 14
> > Windsor N9C3G8
> > Canada
> > Ph 519-971-7847
> >
> >
> > _______________________________________________
> > aspectj-users mailing list
> > aspectj-users@xxxxxxxxxxx
> > https://dev.eclipse.org/mailman/listinfo/aspectj-users
> >
> >
>
>
>
>--
>Eric Bodden
>Sable Research Group
>McGill University, Montréal, Canada
Vinodh Subbiah,
580 Laforet Street,Apt 14
Windsor N9C3G8
Canada
Ph 519-971-7847