Index: ChangeLog =================================================================== RCS file: /cvsroot/classpath/classpath/ChangeLog,v retrieving revision 1.6069 diff -u -r1.6069 ChangeLog --- ChangeLog 16 Jan 2006 09:24:19 -0000 1.6069 +++ ChangeLog 16 Jan 2006 09:53:13 -0000 @@ -1,3 +1,8 @@ +2006-01-16 Gary Benson + + * java/lang/System.java (setSecurityManager): Ensure policy + files are loaded before a security manager is put in place. + 2006-01-16 David Gilbert * javax/swing/text/SimpleAttributeSet.java: Updated API docs all over. 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 16 Jan 2006 09:53:13 -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; }