PR152
authorStefan Ring <stefan@complang.tuwien.ac.at>
Fri, 3 Dec 2010 07:03:41 +0000 (08:03 +0100)
committerStefan Ring <stefan@complang.tuwien.ac.at>
Fri, 3 Dec 2010 07:03:41 +0000 (08:03 +0100)
* src/classes/gnuclasspath/java/security/VMAccessController.java:
Ensure use of setPolicy is reflected by the default SecurityManager.

Patch taken from classpath CVS.

src/classes/gnuclasspath/java/security/VMAccessController.java

index 160df10cb426b9d44980b6b8e3ba6edd2649c7e3..174a0df2bf8464559f55338732674dc79d4f9c69 100644 (file)
@@ -71,7 +71,7 @@ final class VMAccessController
     Permissions permissions = new Permissions();
     permissions.add(new AllPermission());
     ProtectionDomain[] domain = new ProtectionDomain[] {
-      new ProtectionDomain(source, permissions)
+      new ProtectionDomain(source, permissions, null, null)
     };
     DEFAULT_CONTEXT = new AccessControlContext(domain);
   }
@@ -188,12 +188,13 @@ final class VMAccessController
       {
         Class clazz = classes[i];
         String method = methods[i];
+        ClassLoader loader = clazz.getClassLoader();
 
         if (DEBUG)
           {
             debug("checking " + clazz + "." + method);
             // subject to getClassLoader RuntimePermission
-            debug("loader = " + clazz.getClassLoader());
+            debug("loader = " + loader);
           }
 
         // If the previous frame was a call to doPrivileged, then this is
@@ -225,7 +226,8 @@ final class VMAccessController
         // Create a static snapshot of this domain, which may change over time
         // if the current policy changes.
         domains.add(new ProtectionDomain(domain.getCodeSource(),
-                                         domain.getPermissions()));
+                                         domain.getPermissions(),
+                                         loader, null));
       }
 
     if (DEBUG)