equal
deleted
inserted
replaced
1358 public final ClassLoader getParent() { |
1358 public final ClassLoader getParent() { |
1359 if (parent == null) |
1359 if (parent == null) |
1360 return null; |
1360 return null; |
1361 SecurityManager sm = System.getSecurityManager(); |
1361 SecurityManager sm = System.getSecurityManager(); |
1362 if (sm != null) { |
1362 if (sm != null) { |
1363 checkClassLoaderPermission(this, Reflection.getCallerClass()); |
1363 // Check access to the parent class loader |
|
1364 // If the caller's class loader is same as this class loader, |
|
1365 // permission check is performed. |
|
1366 checkClassLoaderPermission(parent, Reflection.getCallerClass()); |
1364 } |
1367 } |
1365 return parent; |
1368 return parent; |
1366 } |
1369 } |
1367 |
1370 |
1368 /** |
1371 /** |
1501 } |
1504 } |
1502 // Circumvent security check since this is package-private |
1505 // Circumvent security check since this is package-private |
1503 return caller.getClassLoader0(); |
1506 return caller.getClassLoader0(); |
1504 } |
1507 } |
1505 |
1508 |
|
1509 /* |
|
1510 * Checks RuntimePermission("getClassLoader") permission |
|
1511 * if caller's class loader is not null and caller's class loader |
|
1512 * is not the same as or an ancestor of the given cl argument. |
|
1513 */ |
1506 static void checkClassLoaderPermission(ClassLoader cl, Class<?> caller) { |
1514 static void checkClassLoaderPermission(ClassLoader cl, Class<?> caller) { |
1507 SecurityManager sm = System.getSecurityManager(); |
1515 SecurityManager sm = System.getSecurityManager(); |
1508 if (sm != null) { |
1516 if (sm != null) { |
1509 // caller can be null if the VM is requesting it |
1517 // caller can be null if the VM is requesting it |
1510 ClassLoader ccl = getClassLoader(caller); |
1518 ClassLoader ccl = getClassLoader(caller); |