package test.basic; import javax.swing.*; import java.io.*; import javassist.*; import java.lang.reflect.*; class Around { hook AroundThrowingHook { AroundThrowingHook(void method()) { execution(method); } around throwing(IOException ex) { System.out.println("CATCHED EXCEPTION: "+ex.getMessage()); return null; } after throwing(IOException ex) { System.out.println("SHOULD NOT OCCUR!!!!!!!!!!!!! EXCEPTION: "+ex.getMessage()); } } hook AroundThrowingHook2 { AroundThrowingHook2(Integer method(Integer arg)) { execution(method); } around throwing(Exception ex) { System.out.println("CATCHED EXCEPTION: "+ex.getMessage()); return new Integer(arg.intValue()+10); } } hook AroundReturningHook { AroundReturningHook(void method()) { execution(method); } around returning(Integer i) { return new Integer((int)(i.intValue()*0.9)); } } }