Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

AfterThrowingAdviceSyntaxError.java 605B

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