1 package test; 2 3 import alt.jiapi.event.ExceptionEventProducer; 4 import alt.jiapi.event.ExceptionListener; 5 import alt.jiapi.event.ExceptionEvent; 6 import alt.jiapi.*; 7 8 13 public class ExceptionEventTest extends InstrumentorTest implements ExceptionListener { 14 public static void main(String [] args) throws Exception { 15 ExceptionEventTest ft = new ExceptionEventTest(); 16 ft.run(args); 17 } 18 19 public ExceptionEventTest() throws JiapiException { 20 InstrumentationDescriptor id = new InstrumentationDescriptor(); 21 ctx.addInstrumentationDescriptor(id); 22 23 addInclusionRules(id, getInclusionRules()); 24 addExclusionRules(id, getExclusionRules()); 25 26 ExceptionEventProducer fep = 27 new ExceptionEventProducer(id, System.getProperty("resolution", "*")); 28 29 fep.addExceptionListener(this); 30 } 31 32 public void exceptionCaught(ExceptionEvent event) { 34 Object target = event.getTarget(); 35 String __target = null; 36 if (target != null) { 37 __target = target.getClass().toString(); 38 } 39 40 System.out.println("Exception caught : " + event + "::" + 41 __target); 42 } 43 44 45 public String defaultClassName() { 47 return "test.ExceptionTest"; 48 } 49 } 50 | Popular Tags |