exception « aspectj « Java Enterprise Q&A





1. Is it possible to catch all exceptions using aspectj?    stackoverflow.com

I would like to make sure an advice is executed every time an exception is thrown by a method that is annotated with a specific annotation. Is this possible?

2. How to swallow a exception at AfterThrowing in AspectJ    stackoverflow.com

In AspectJ, I want to swallow a exception.

@Aspect
public class TestAspect {

 @Pointcut("execution(public * *Throwable(..))")
 void throwableMethod() {}

 @AfterThrowing(pointcut = "throwableMethod()", throwing = "e")
 public void swallowThrowable(Throwable e) throws Exception {
  ...

3. Getting a return value or exception from AspectJ?    stackoverflow.com

I am able to get the signature and arguments from advised method calls, but I cannot figure out how to get the return values or exceptions. I'm kind of assuming that ...

4. Exception produced in "before()" advice is caught too late    stackoverflow.com

I'd like to place some assert in before advice. But I cannot understand how the exception is propagated. It arrives later than expected. Why it happens? Unfortunately I cannot find ...