changeset 10372:fc4646e5a11f

8055314: Update refactoring for new loader Reviewed-by: mullan, ahgross, igerasim
author mchung
date Fri, 29 Aug 2014 20:16:35 -0700
parents 86178922ee77
children 0d6cc86942f8
files src/share/classes/java/lang/ClassLoader.java
diffstat 1 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/java/lang/ClassLoader.java	Tue Aug 26 15:53:05 2014 +0100
+++ b/src/share/classes/java/lang/ClassLoader.java	Fri Aug 29 20:16:35 2014 -0700
@@ -1365,7 +1365,10 @@
             return null;
         SecurityManager sm = System.getSecurityManager();
         if (sm != null) {
-            checkClassLoaderPermission(this, Reflection.getCallerClass());
+            // Check access to the parent class loader
+            // If the caller's class loader is same as this class loader,
+            // permission check is performed.
+            checkClassLoaderPermission(parent, Reflection.getCallerClass());
         }
         return parent;
     }
@@ -1508,6 +1511,11 @@
         return caller.getClassLoader0();
     }
 
+    /*
+     * Checks RuntimePermission("getClassLoader") permission
+     * if caller's class loader is not null and caller's class loader
+     * is not the same as or an ancestor of the given cl argument.
+     */
     static void checkClassLoaderPermission(ClassLoader cl, Class<?> caller) {
         SecurityManager sm = System.getSecurityManager();
         if (sm != null) {