Lines 117-139
Link Here
|
117 |
checkLoadedClasses (className, false); |
117 |
checkLoadedClasses (className, false); |
118 |
} |
118 |
} |
119 |
} |
119 |
} |
120 |
|
120 |
|
121 |
protected void classLoaded (ReferenceType referenceType) { |
121 |
protected void classLoaded (ReferenceType referenceType) { |
122 |
if (verbose) |
122 |
if (verbose) |
123 |
System.out.println ("B class loaded: " + referenceType); |
123 |
System.out.println ("B class loaded: " + referenceType); |
124 |
|
124 |
|
125 |
Location location = getLocation ( |
125 |
List locations = getLocations ( |
126 |
referenceType, |
126 |
referenceType, |
127 |
breakpoint.getStratum (), |
127 |
breakpoint.getStratum (), |
128 |
breakpoint.getSourceName (), |
128 |
breakpoint.getSourceName (), |
|
|
129 |
breakpoint.getSourcePath(), |
129 |
lineNumber |
130 |
lineNumber |
130 |
); |
131 |
); |
131 |
if (location == null) return; |
132 |
if (locations.isEmpty()) return; |
132 |
try { |
133 |
for (Iterator it = locations.iterator(); it.hasNext();) { |
133 |
BreakpointRequest br = getEventRequestManager (). |
134 |
Location location = (Location)it.next(); |
134 |
createBreakpointRequest (location); |
135 |
try { |
135 |
addEventRequest (br); |
136 |
BreakpointRequest br = getEventRequestManager (). |
136 |
} catch (VMDisconnectedException e) { |
137 |
createBreakpointRequest (location); |
|
|
138 |
addEventRequest (br); |
139 |
} catch (VMDisconnectedException e) { |
140 |
} |
137 |
} |
141 |
} |
138 |
} |
142 |
} |
139 |
|
143 |
|
Lines 148-160
Link Here
|
148 |
return super.exec (event); |
152 |
return super.exec (event); |
149 |
} |
153 |
} |
150 |
|
154 |
|
151 |
private static Location getLocation ( |
155 |
private static List getLocations ( |
152 |
ReferenceType referenceType, |
156 |
ReferenceType referenceType, |
153 |
String stratum, |
157 |
String stratum, |
154 |
String sourceName, |
158 |
String sourceName, |
|
|
159 |
String bpSourcePath, |
155 |
int lineNumber |
160 |
int lineNumber |
156 |
) { |
161 |
) { |
157 |
try { |
162 |
try { |
|
|
163 |
|
158 |
List list = new ArrayList (referenceType.locationsOfLine ( |
164 |
List list = new ArrayList (referenceType.locationsOfLine ( |
159 |
stratum, |
165 |
stratum, |
160 |
sourceName, |
166 |
sourceName, |
Lines 165-171
Link Here
|
165 |
referenceType + " stratum=" + stratum + |
171 |
referenceType + " stratum=" + stratum + |
166 |
" source name=" + sourceName + " lineNumber " + lineNumber + |
172 |
" source name=" + sourceName + " lineNumber " + lineNumber + |
167 |
" (#" + list.size () + ")"); |
173 |
" (#" + list.size () + ")"); |
168 |
if (!list.isEmpty ()) return (Location) list.get (0); |
174 |
if (!list.isEmpty ()) { |
|
|
175 |
if (bpSourcePath == null) |
176 |
return list; |
177 |
bpSourcePath = bpSourcePath.replace('/', java.io.File.separatorChar); |
178 |
if (verbose) |
179 |
System.out.println("B source path: " + bpSourcePath); |
180 |
ArrayList locations = new ArrayList(); |
181 |
for (Iterator it = list.iterator(); it.hasNext();) { |
182 |
Location l = (Location)it.next(); |
183 |
if (l.sourcePath().equals(bpSourcePath)) |
184 |
locations.add(l); |
185 |
} |
186 |
if (verbose) |
187 |
System.out.println("B relevant location(s) for path '" + bpSourcePath + "': " + locations); |
188 |
if (!locations.isEmpty()) |
189 |
return locations; |
190 |
} |
169 |
|
191 |
|
170 |
// add lines from innerclasses |
192 |
// add lines from innerclasses |
171 |
Iterator i = referenceType.nestedTypes ().iterator (); |
193 |
Iterator i = referenceType.nestedTypes ().iterator (); |
Lines 181-187
Link Here
|
181 |
referenceType + " stratum=" + stratum + |
203 |
referenceType + " stratum=" + stratum + |
182 |
" source name=" + sourceName + " lineNumber" + lineNumber + |
204 |
" source name=" + sourceName + " lineNumber" + lineNumber + |
183 |
":= " + list.size ()); |
205 |
":= " + list.size ()); |
184 |
if (!list.isEmpty ()) return (Location) list.get (0); |
206 |
if (!list.isEmpty()) return list; |
185 |
} |
207 |
} |
186 |
} catch (AbsentInformationException ex) { |
208 |
} catch (AbsentInformationException ex) { |
187 |
// we are not able to create breakpoint in this situation. |
209 |
// we are not able to create breakpoint in this situation. |
Lines 195-201
Link Here
|
195 |
// classes only. But... |
217 |
// classes only. But... |
196 |
ex.printStackTrace (); |
218 |
ex.printStackTrace (); |
197 |
} |
219 |
} |
198 |
return null; |
220 |
return new ArrayList(); |
199 |
} |
221 |
} |
200 |
} |
222 |
} |
201 |
|
223 |
|