提交 7f97885c 编写于 作者: M mchung

8055314: Update refactoring for new loader

Reviewed-by: mullan, ahgross, igerasim
上级 57d20820
...@@ -1365,7 +1365,10 @@ public abstract class ClassLoader { ...@@ -1365,7 +1365,10 @@ public abstract class ClassLoader {
return null; return null;
SecurityManager sm = System.getSecurityManager(); SecurityManager sm = System.getSecurityManager();
if (sm != null) { 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; return parent;
} }
...@@ -1508,6 +1511,11 @@ public abstract class ClassLoader { ...@@ -1508,6 +1511,11 @@ public abstract class ClassLoader {
return caller.getClassLoader0(); 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) { static void checkClassLoaderPermission(ClassLoader cl, Class<?> caller) {
SecurityManager sm = System.getSecurityManager(); SecurityManager sm = System.getSecurityManager();
if (sm != null) { if (sm != null) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册