You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Exceptions.java 460B

123456789101112131415161718
  1. package tjpStaticPart;
  2. import java.io.*;
  3. import org.aspectj.lang.*;
  4. public aspect Exceptions {
  5. pointcut exceptionMethods () :
  6. call(java.io.*.new(..) throws FileNotFoundException);
  7. Object around () throws FileNotFoundException : exceptionMethods() && !within(Exceptions) {
  8. System.err.println("before: " + thisJoinPoint.getStaticPart());
  9. Object obj = proceed();
  10. System.err.println("after: " + thisJoinPoint.getStaticPart());
  11. return obj;
  12. }
  13. }