提交 4146ce03 编写于 作者: H hb

8157739: Classloader Consistency Checking

Reviewed-by: ahgross, akulyakh, dfuchs, jwilhelm, skoivu
上级 b54276fd
...@@ -39,8 +39,9 @@ public class ClassLoaderWithRepository extends ClassLoader { ...@@ -39,8 +39,9 @@ public class ClassLoaderWithRepository extends ClassLoader {
} }
protected Class<?> findClass(String name) throws ClassNotFoundException { protected Class<?> findClass(String name) throws ClassNotFoundException {
Class<?> cls;
try { try {
return repository.loadClass(name); cls = repository.loadClass(name);
} catch (ClassNotFoundException cne) { } catch (ClassNotFoundException cne) {
if (cl2 != null) { if (cl2 != null) {
return cl2.loadClass(name); return cl2.loadClass(name);
...@@ -48,6 +49,15 @@ public class ClassLoaderWithRepository extends ClassLoader { ...@@ -48,6 +49,15 @@ public class ClassLoaderWithRepository extends ClassLoader {
throw cne; 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 ClassLoaderRepository repository;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册