1 package jde.debugger.spec;
4 import com.sun.jdi.request.*;
7 import jde.debugger.JDEException;
10 * LineBreakpointSpec.java
14 * Created: Thu Jul 15 13:00:34 1999
18 * @version $Revision: 1.4 $
21 public class LineBreakpointSpec extends BreakpointSpec {
23 private int lineNumber;
25 public LineBreakpointSpec(ReferenceTypeSpec refSpec,
28 this.lineNumber = line;
31 boolean resolve(ReferenceType refType) throws JDEException {
32 if (!(refType instanceof ClassType)) {
33 // remove spec from list of current specs
34 throw new JDEException("'"+refType+"' is not a Class");
36 Location location = getLocation((ClassType)refType);
37 BreakpointRequest br = refType.virtualMachine().eventRequestManager().createBreakpointRequest(location);
43 private Location getLocation(ClassType clazz) throws JDEException {
44 Location location = null;
48 locs = clazz.locationsOfLine(lineNumber);
49 } catch (InvalidLineNumberException ex) {
50 throw new JDEException("Line #"+lineNumber+" does not exist in "+clazz+".");
52 if (locs.size() == 0) {
53 // remove spec from list of current specs
54 throw new JDEException("Line #"+lineNumber+" does not exist int "+clazz+".");
56 // XXX handle multiple locations
57 location = (Location)locs.get(0);
58 if (location.method() == null) {
59 // remove spec from list of current specs
60 throw new JDEException("Line #"+lineNumber+" does not correspond to a method in "+
63 } catch (AbsentInformationException e) {
64 // remove spec from list of current specs
65 throw new JDEException("Line Information missing for Class '"+clazz+"'");
70 public int getLineNumber() {
74 } // LineBreakpointSpec
77 * $Log: LineBreakpointSpec.java,v $
78 * Revision 1.4 2003/01/15 06:06:15 paulk
79 * Petter Mahlen's changes.
83 // End of LineBreakpointSpec.java