< prev index next >
src/share/classes/com/sun/jmx/remote/util/ClassLoaderWithRepository.java
Print this page
rev 1549 : 8157739: Classloader Consistency Checking
Reviewed-by: ahgross, akulyakh, dfuchs, jwilhelm, skoivu
@@ -37,19 +37,29 @@
repository = clr;
this.cl2 = cl2;
}
protected Class findClass(String name) throws ClassNotFoundException {
+ Class<?> cls;
try {
- return repository.loadClass(name);
+ cls = repository.loadClass(name);
} catch (ClassNotFoundException cne) {
if (cl2 != null) {
return cl2.loadClass(name);
} else {
throw cne;
}
}
+
+ if(!cls.getName().equals(name)){
+ if (cl2 != null) {
+ return cl2.loadClass(name);
+ } else {
+ throw new ClassNotFoundException(name);
+ }
+ }
+ return cls;
}
private ClassLoaderRepository repository;
private ClassLoader cl2;
}
< prev index next >