8157739: Classloader Consistency Checking

Reviewed-by: ahgross, akulyakh, dfuchs, jwilhelm, skoivu
This commit is contained in:
Harsha Wardhana B 2016-07-12 16:46:45 +01:00
parent b846afbe35
commit 2ab2dc62ce

View File

@ -39,8 +39,9 @@ public class ClassLoaderWithRepository extends ClassLoader {
}
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);
@ -48,6 +49,15 @@ public class ClassLoaderWithRepository extends ClassLoader {
throw cne;
}
}
if(!cls.getName().equals(name)){
if (cl2 != null) {
return cl2.loadClass(name);
} else {
throw new ClassNotFoundException(name);
}
}
return cls;
}
private ClassLoaderRepository repository;