changeset 11946:588df0398c57

8157739: Classloader Consistency Checking Reviewed-by: ahgross, akulyakh, dfuchs, jwilhelm, skoivu
author hb
date Tue, 12 Jul 2016 16:46:45 +0100
parents 49681546459c
children d689f7b806c8
files src/share/classes/com/sun/jmx/remote/util/ClassLoaderWithRepository.java
diffstat 1 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/com/sun/jmx/remote/util/ClassLoaderWithRepository.java	Wed Jun 29 11:51:59 2016 -0400
+++ b/src/share/classes/com/sun/jmx/remote/util/ClassLoaderWithRepository.java	Tue Jul 12 16:46:45 2016 +0100
@@ -39,8 +39,9 @@
    }
 
     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 @@
                 throw cne;
             }
         }
+
+        if(!cls.getName().equals(name)){
+            if (cl2 != null) {
+                return cl2.loadClass(name);
+            } else {
+                throw new ClassNotFoundException(name);
+            }
+        }
+        return cls;
     }
 
     private ClassLoaderRepository repository;