0

Hei. In our Java-project we are trying to use AspectJ to clean some Exceptions from the serverlogs. What we need is to weave advices into a jar-file such that it also triggers (also on reflective calls).

We are using maven and the aspectj-maven-plugin 1.7.3. When building our project the advices are being woven to all the methods, but on some of them they do not trigger.

Here is an example advice:

@Around("execution(* com.company.XX..*(..))")
public Object noSuchVariableExceptionWrapper(ProceedingJoinPoint proceedingJoinPoint) 
throws Throwable{
    try{
        return proceedingJoinPoint.proceed();
    }
    catch(Exception e){
        // Code with a short log entry 
        // instead of throwing exception
        return null;
    }
}

We have quite a bit of code in xml-files that are parsed and run through reflection.

Any tips on how to get around this problem?

alzamon
  • 1
  • 4

1 Answers1

0

sounds like you want to use after throwing instead.

aepurniet
  • 1,719
  • 16
  • 24
  • No, I don't think after throwing will work. Then it's already to late to stop the exception from printing to the server-log. – alzamon Dec 02 '13 at 08:42