Lines 227-233
Link Here
|
227 |
if (shouldDelegateResource(path, null)) cls = systemCL.loadClass(name); |
227 |
if (shouldDelegateResource(path, null)) cls = systemCL.loadClass(name); |
228 |
}*/ |
228 |
}*/ |
229 |
} else { |
229 |
} else { |
230 |
cls = doLoadClassFromParents(del, path, pkg, name, cls); |
230 |
// multicovered package, search in order |
|
|
231 |
for (ProxyClassLoader pcl : parents) { // all our accessible parents |
232 |
if (del.contains(pcl) && shouldDelegateResource(path, pcl)) { // that cover given package |
233 |
Class _cls = pcl.selfLoadClass(pkg, name); |
234 |
if (_cls != null) { |
235 |
if (cls == null) { |
236 |
cls = _cls; |
237 |
} else if (cls != _cls) { |
238 |
String message = "Will not load class " + name + " arbitrarily from one of " + |
239 |
cls.getClassLoader() + " and " + pcl + " starting from " + this + |
240 |
"; see http://wiki.netbeans.org/DevFaqModuleCCE"; |
241 |
ClassNotFoundException cnfe = new ClassNotFoundException(message); |
242 |
if (LOGGER.isLoggable(Level.FINE)) { |
243 |
LOGGER.log(Level.FINE, null, cnfe); |
244 |
} else { |
245 |
LOGGER.warning(message); |
246 |
} |
247 |
throw cnfe; |
248 |
} |
249 |
} |
250 |
} |
251 |
} |
231 |
if (cls == null && del.contains(this)) cls = selfLoadClass(pkg, name); |
252 |
if (cls == null && del.contains(this)) cls = selfLoadClass(pkg, name); |
232 |
if (cls != null) sclPackages.put(pkg, false); |
253 |
if (cls != null) sclPackages.put(pkg, false); |
233 |
} |
254 |
} |
Lines 235-247
Link Here
|
235 |
try { |
256 |
try { |
236 |
cls = systemCL.loadClass(name); |
257 |
cls = systemCL.loadClass(name); |
237 |
} catch (ClassNotFoundException e) { |
258 |
} catch (ClassNotFoundException e) { |
238 |
cls = doLoadClassFromParents(null, path, pkg, name, cls); |
259 |
throw new ClassNotFoundException(diagnosticCNFEMessage(e.getMessage(), del), e); |
239 |
if (cls == null) { |
|
|
240 |
cls = selfLoadClass(pkg, name); |
241 |
if (cls == null) { |
242 |
throw new ClassNotFoundException(diagnosticCNFEMessage(e.getMessage(), del), e); |
243 |
} |
244 |
} |
245 |
} |
260 |
} |
246 |
} |
261 |
} |
247 |
if (cls == null) { |
262 |
if (cls == null) { |
Lines 271-303
Link Here
|
271 |
" and declared parents " + parentSetS; |
286 |
" and declared parents " + parentSetS; |
272 |
} |
287 |
} |
273 |
|
288 |
|
274 |
private Class doLoadClassFromParents(Set<ProxyClassLoader> del, final String path, String pkg, String name, Class cls) throws ClassNotFoundException { |
|
|
275 |
// multicovered package, search in order |
276 |
for (ProxyClassLoader pcl : parents) { // all our accessible parents |
277 |
if (del == null || (del.contains(pcl) && shouldDelegateResource(path, pcl))) { |
278 |
// that cover given package |
279 |
Class _cls = pcl.selfLoadClass(pkg, name); |
280 |
if (_cls != null) { |
281 |
if (cls == null) { |
282 |
cls = _cls; |
283 |
} else if (cls != _cls) { |
284 |
String message = "Will not load class " + name + " arbitrarily from one of " + |
285 |
cls.getClassLoader() + " and " + pcl + " starting from " + this + |
286 |
"; see http://wiki.netbeans.org/DevFaqModuleCCE"; |
287 |
ClassNotFoundException cnfe = new ClassNotFoundException(message); |
288 |
if (LOGGER.isLoggable(Level.FINE)) { |
289 |
LOGGER.log(Level.FINE, null, cnfe); |
290 |
} else { |
291 |
LOGGER.warning(message); |
292 |
} |
293 |
throw cnfe; |
294 |
} |
295 |
} |
296 |
} |
297 |
} |
298 |
return cls; |
299 |
} |
300 |
|
301 |
/** May return null */ |
289 |
/** May return null */ |
302 |
private synchronized Class selfLoadClass(String pkg, String name) { |
290 |
private synchronized Class selfLoadClass(String pkg, String name) { |
303 |
Class cls = findLoadedClass(name); |
291 |
Class cls = findLoadedClass(name); |
Lines 393-401
Link Here
|
393 |
|
381 |
|
394 |
// uncovered package, go directly to SCL |
382 |
// uncovered package, go directly to SCL |
395 |
if (url == null && shouldDelegateResource(path, null)) url = systemCL.getResource(name); |
383 |
if (url == null && shouldDelegateResource(path, null)) url = systemCL.getResource(name); |
396 |
if (url == null) { |
|
|
397 |
url = findResource(name); |
398 |
} |
399 |
|
384 |
|
400 |
return url; |
385 |
return url; |
401 |
} |
386 |
} |