|
What this is
Other links
The source code
/*
* Sun Public License Notice
*
* The contents of this file are subject to the Sun Public License
* Version 1.0 (the "License"). You may not use this file except in
* compliance with the License. A copy of the License is available at
* http://www.sun.com/
*
* The Original Code is NetBeans. The Initial Developer of the Original
* Code is Sun Microsystems, Inc. Portions Copyright 1997-2000 Sun
* Microsystems, Inc. All Rights Reserved.
*/
package org.netbeans.modules.debugger.jpda.breakpoints;
import com.sun.jdi.ReferenceType;
import com.sun.jdi.VMDisconnectedException;
import com.sun.jdi.event.ClassPrepareEvent;
import com.sun.jdi.event.Event;
import com.sun.jdi.event.ExceptionEvent;
import com.sun.jdi.request.ClassPrepareRequest;
import com.sun.jdi.request.ExceptionRequest;
import java.util.Iterator;
import java.util.List;
import org.netbeans.api.debugger.jpda.ClassLoadUnloadBreakpoint;
import org.netbeans.api.debugger.jpda.ExceptionBreakpoint;
import org.netbeans.api.debugger.jpda.JPDABreakpoint;
import org.netbeans.modules.debugger.jpda.JPDADebuggerImpl;
import org.netbeans.modules.debugger.jpda.util.Executor;
/**
* Implementation of breakpoint on method.
*
* @author Jan Jancura
*/
public class ExceptionBreakpointImpl extends ClassBasedBreakpoint {
private ExceptionBreakpoint breakpoint;
public ExceptionBreakpointImpl (ExceptionBreakpoint breakpoint, JPDADebuggerImpl debugger) {
super (breakpoint, debugger);
this.breakpoint = breakpoint;
set ();
}
protected void setRequests () {
setClassRequests (
new String[] {breakpoint.getExceptionClassName ()},
new String[0],
ClassLoadUnloadBreakpoint.TYPE_CLASS_LOADED
);
checkLoadedClasses (breakpoint.getExceptionClassName (), true);
}
protected void classLoaded (ReferenceType referenceType) {
try {
ExceptionRequest er = getEventRequestManager ().
createExceptionRequest (
referenceType,
(breakpoint.getCatchType () &
ExceptionBreakpoint.TYPE_EXCEPTION_CATCHED) != 0,
(breakpoint.getCatchType () &
ExceptionBreakpoint.TYPE_EXCEPTION_UNCATCHED) != 0
);
addEventRequest (er);
} catch (VMDisconnectedException e) {
}
}
public boolean exec (Event event) {
if (event instanceof ExceptionEvent)
return perform (
breakpoint.getCondition (),
((ExceptionEvent) event).thread (),
((ExceptionEvent) event).location().declaringType(),
((ExceptionEvent) event).exception ()
);
return super.exec (event);
}
}
|
| ... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.