[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Exception dilemma

Hallo,

for testing purpose I want to throw an Exception after a method returns:

    after() returning throws InterruptedException : applicationCode() {
        throw new InterruptedException();
    }

This works as expected for methods which throws InterruptedException. Now I want to make it more general and addresses *all* methods which can throw an checked exception:

    after() returning throws Exception : applicationCode() {
        ...
    }

But here I got an error message ("can't throw checked exception 'java.lang.Exception' at this join point...") which is clear because the pointcut "applicationCode()" addresses e.g. an InterruptException.

Has anybody a hint or tip how I can realize it without defining an advice for each possible checked Exception?

regards
Oliver