Gary Benson wrote:
> Jeroen Frijters wrote:
> > I think I figured it out. With the attached test I could reproduce
> > the problem on IKVM as well. The attach Classpath patch fixing
> > things, although past 0.20 I think we should refactor the security
> > properties like I did with the system properties (i.e. introduce a
> > gnu.classpath.SecurityProperties class).
> 
> The change to java.security.Security has made the majority of the
> Mauve workarounds unnecessary: thanks!  Now to see if I can get rid
> of the last little bit...

The attached patch allows all Mauve workarounds to be removed.
Ok to commit?

Cheers,
Gary
Index: ChangeLog
===================================================================
RCS file: /cvsroot/classpath/classpath/ChangeLog,v
retrieving revision 1.6049
diff -u -r1.6049 ChangeLog
--- ChangeLog   13 Jan 2006 14:30:27 -0000      1.6049
+++ ChangeLog   13 Jan 2006 14:33:56 -0000
@@ -1,3 +1,8 @@
+2006-01-13  Gary Benson  <[EMAIL PROTECTED]>
+
+       * java/lang/System.java (setSecurityManager): Ensure policy
+       files are loaded before a security manager is put in place.
+
 2006-01-13  Mark Wielaard  <[EMAIL PROTECTED]>
 
        * configure.ac: Set version to 0.20.
Index: java/lang/System.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/lang/System.java,v
retrieving revision 1.53
diff -u -r1.53 System.java
--- java/lang/System.java       13 Sep 2005 22:19:15 -0000      1.53
+++ java/lang/System.java       13 Jan 2006 14:33:56 -0000
@@ -178,6 +178,23 @@
     if (SecurityManager.current != null)
       SecurityManager.current.checkPermission
         (new RuntimePermission("setSecurityManager"));
+
+    // java.security.Security's class initialiser loads and parses the
+    // policy files.  If it hasn't been run already it will be run
+    // during the first permission check.  That initialisation will
+    // fail if a very restrictive security manager is in force, so we
+    // preload it here.
+    if (SecurityManager.current == null)
+      {
+       try
+         {
+           Class.forName("java.security.Security");
+         }
+       catch (Throwable t)
+         {
+         }
+      }
+    
     SecurityManager.current = sm;
   }
 
_______________________________________________
Classpath mailing list
Classpath@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath

Reply via email to