SecurityManager.java: Load and initialize java.security.Security.
authorAndrew Haley <aph@gcc.gnu.org>
Mon, 29 Jan 2007 13:43:22 +0000 (13:43 +0000)
committerAndrew Haley <aph@gcc.gnu.org>
Mon, 29 Jan 2007 13:43:22 +0000 (13:43 +0000)
2007-01-26  Andrew Haley  <aph@redhat.com>

        * java/lang/SecurityManager.java: Load and initialize
        java.security.Security.

From-SVN: r121287

libjava/classpath/java/lang/SecurityManager.java
libjava/classpath/lib/java/lang/SecurityManager.class

index 61b4612b1aa0061b2ad415d4e098a89223b2f59f..ff84d95060811cc4d5ab113179a85450eb9c5a9a 100644 (file)
@@ -167,6 +167,18 @@ public class SecurityManager
    */
   public SecurityManager()
   {
+    /* "When there is security manager installed, the security manager
+       need to check the package access. However, if the security
+       manager itself uses any unloaded class, it will trigger the
+       classloading, which causes infinite loop. There is no easy
+       legal solution. The workaround will be that security manager
+       can not depend on any unloaded class. In the constructor of
+       security manager, it must transitively load all classes it
+       refers to."  Sun bug #4242924.  */
+
+    // Load and initialize java.security.Security
+    java.security.Security.getProvider((String)null);
+
     SecurityManager sm = System.getSecurityManager();
     if (sm != null)
       sm.checkPermission(new RuntimePermission("createSecurityManager"));
index c8c93029712d9825061cf4686b26f064855ead8d..7f080b51604cb140398997cbd38d78f420756d3d 100644 (file)
Binary files a/libjava/classpath/lib/java/lang/SecurityManager.class and b/libjava/classpath/lib/java/lang/SecurityManager.class differ