Hi, At the moment Security.setProperty() will not allow the setting of null property values. Since Security.getProperty() returns null for unset properties this means that the following will fail:
String key = "some.old.property"; Security.setProperty(key, Security.getProperty(key)); The javadoc is unclear: it says nothing about null values, but it doesn't say anything about throwing NullPointerExceptions (which we currently do). I tried it on a proprietary JVM and it accepted the null pointer. On the principle of accepting what you emit I think we should do the same. Also included in this patch is the spelling correction s/datnum/datum/. Cheers, Gary
Index: ChangeLog =================================================================== RCS file: /cvsroot/classpath/classpath/ChangeLog,v retrieving revision 1.5793 diff -u -r1.5793 ChangeLog --- ChangeLog 12 Dec 2005 13:24:22 -0000 1.5793 +++ ChangeLog 12 Dec 2005 15:28:48 -0000 @@ -1,3 +1,8 @@ +2005-12-12 Gary Benson <[EMAIL PROTECTED]> + + * java/security/Security.java (setProperty): Spelling correction. + * java/security/Security.java (setProperty): Allow null values. + 2005-12-12 Roman Kennke <[EMAIL PROTECTED]> * javax/swing/ViewportLayout.java Index: java/security/Security.java =================================================================== RCS file: /cvsroot/classpath/classpath/java/security/Security.java,v retrieving revision 1.37 diff -u -r1.37 Security.java --- java/security/Security.java 18 Sep 2005 03:06:39 -0000 1.37 +++ java/security/Security.java 7 Dec 2005 15:44:29 -0000 @@ -399,20 +399,23 @@ * </p> * * @param key the name of the property to be set. - * @param datnum the value of the property to be set. + * @param datum the value of the property to be set. * @throws SecurityException if a security manager exists and its * [EMAIL PROTECTED] SecurityManager#checkPermission(Permission)} method denies access * to set the specified security property value. * @see #getProperty(String) * @see SecurityPermission */ - public static void setProperty(String key, String datnum) + public static void setProperty(String key, String datum) { SecurityManager sm = System.getSecurityManager(); if (sm != null) sm.checkSecurityAccess("setProperty." + key); - secprops.put(key, datnum); + if (datum == null) + secprops.remove(key); + else + secprops.put(key, datum); } /**
_______________________________________________ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches