Intercepting constructors that handle exceptions

View: New views
2 Messages — Rating Filter:   Alert me  

Intercepting constructors that handle exceptions

by jonamep :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Folks,

I've made a pointcut that intercepts a constructor,:

pointcut Test(Bank uc, File f) : execution(public Bank.new(File)) && args(f) && this(uc);

the constructor handles an exception...but I don't know how to intercept it. I 've tried sorrounding proceed() whit try catch but it didn't run...

   
    void around(Object uc, File f) throws Exception : Test(uc,f) {
        ....
    }

so what goes inside around ?

Thanks!!

jp

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

Re: Intercepting constructors that handle exceptions

by Ramnivas Laddad :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I am not entirely sure about the question, but I think you need
something along the following lines:

void around(Object uc, File f) throws Exception : Test(uc,f) {
       try {
            proceed(uc, f);
       } catch (Exception ex) {
             ... your exception processing logic
      }
}

Or perhaps this:
after() throwing(ex) : Test(uc,f) {
     ... your exception processing logic
}

-Ramnivas

2009/6/12 João Paulo Sabino de Moraes <jonamep@...>:

> Hi Folks,
>
> I've made a pointcut that intercepts a constructor,:
>
> pointcut Test(Bank uc, File f) : execution(public Bank.new(File)) && args(f)
> && this(uc);
>
> the constructor handles an exception...but I don't know how to intercept it.
> I 've tried sorrounding proceed() whit try catch but it didn't run...
>
>
>     void around(Object uc, File f) throws Exception : Test(uc,f) {
>         ....
>     }
>
> so what goes inside around ?
>
> Thanks!!
>
> jp
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@...
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
>
_______________________________________________
aspectj-users mailing list
aspectj-users@...
https://dev.eclipse.org/mailman/listinfo/aspectj-users