1 22 23 package org.aspectj.debugger.request; 24 25 import org.aspectj.debugger.base.*; 26 27 import com.sun.jdi.*; 28 import com.sun.jdi.request.*; 29 import com.sun.jdi.event.*; 30 31 39 40 public abstract class ExceptionRequestAction extends RequestAction { 41 42 protected String className; 43 44 ExceptionRequestAction(Debugger debugger, String className) { 45 super(debugger); 46 this.className = className; 47 } 48 49 EventRequest resolve(ReferenceType refType) throws MultipleLocationsException { 50 ExceptionRequest request = null; 51 try { 52 if (refType.name().equals(className)) { 53 EventRequestManager em = vm().eventRequestManager(); 54 request = em.createExceptionRequest(refType, 55 notifyCaught(), 56 notifyUncaught()); 57 request.enable(); 59 request.setSuspendPolicy(EventRequest.SUSPEND_ALL); 60 } 61 } catch (NoVMException e) { 62 } 63 return request; 64 } 65 66 public String getClassName() { 67 return className; 68 } 69 70 abstract boolean notifyCaught(); 71 abstract boolean notifyUncaught(); 72 73 public boolean equals(Object other) { 74 if (other == null || !(other instanceof ExceptionRequestAction)) { 75 return super.equals(other); 76 } 77 ExceptionRequestAction ra = (ExceptionRequestAction) other; 78 return getClassName().equals(ra.getClassName()); 79 } 80 81 public void exceptionEvent(ExceptionEvent e) { 82 print(e); 83 } 84 } 85 | Popular Tags |