blob: 088dcdc9a2a79a3b9561ca263e3cf42473742215 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
import org.aspectj.lang.*;
public class AfterThrowingAdviceSyntaxError {
public static void main(String[] args) {
perform();
}
private static void perform() {
Object nullObj = null;
nullObj.toString();
}
}
aspect ExceptionLoggerAspectV2
{
pointcut exceptionLogMethods()
: call(* *.*(..)) && !within(ExceptionLoggerAspectV2);
after() thowing(Throwable ex) : exceptionLogMethods() {
Signature sig = thisJoinPointStaticPart.getSignature();
System.out.printl("WARNING: "
+ sig.getDeclaringType().getName() + " "
+ sig.getName() + " "
+ "Exception logger aspect " + ex);
}
}
|