diff options
author | mark <mark@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-01-17 18:09:40 +0000 |
---|---|---|
committer | mark <mark@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-01-17 18:09:40 +0000 |
commit | 2d8cf20d0d5ca6b1fbdefc22229d4b7cf1497ede (patch) | |
tree | c976ca91e3ef0bda3b34b37c0195145638d8d08e /libjava/classpath/java/security/Security.java | |
parent | a3ef37ddfeddcc5b0f1c5068d8fdeb25a302d5cd (diff) | |
download | ppe42-gcc-2d8cf20d0d5ca6b1fbdefc22229d4b7cf1497ede.tar.gz ppe42-gcc-2d8cf20d0d5ca6b1fbdefc22229d4b7cf1497ede.zip |
Imported GNU Classpath 0.20
* Makefile.am (AM_CPPFLAGS): Add classpath/include.
* java/nio/charset/spi/CharsetProvider.java: New override file.
* java/security/Security.java: Likewise.
* sources.am: Regenerated.
* Makefile.in: Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@109831 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/classpath/java/security/Security.java')
-rw-r--r-- | libjava/classpath/java/security/Security.java | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/libjava/classpath/java/security/Security.java b/libjava/classpath/java/security/Security.java index fd51d0535b3..d26d049c524 100644 --- a/libjava/classpath/java/security/Security.java +++ b/libjava/classpath/java/security/Security.java @@ -1,5 +1,6 @@ /* Security.java --- Java base security class implementation - Copyright (C) 1999, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. + Copyright (C) 1999, 2001, 2002, 2003, 2004, 2005, 2006 + Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -41,6 +42,7 @@ package java.security; import gnu.classpath.SystemProperties; import gnu.classpath.Configuration; +import gnu.classpath.VMStackWalker; import java.io.IOException; import java.io.InputStream; @@ -354,6 +356,14 @@ public final class Security */ public static Provider getProvider(String name) { + if (name == null) + return null; + else + { + name = name.trim(); + if (name.length() == 0) + return null; + } Provider p; int max = providers.size (); for (int i = 0; i < max; i++) @@ -383,8 +393,11 @@ public final class Security */ public static String getProperty(String key) { + // XXX To prevent infinite recursion when the SecurityManager calls us, + // don't do a security check if the caller is trusted (by virtue of having + // been loaded by the bootstrap class loader). SecurityManager sm = System.getSecurityManager(); - if (sm != null) + if (sm != null && VMStackWalker.getCallingClassLoader() != null) sm.checkSecurityAccess("getProperty." + key); return secprops.getProperty(key); @@ -399,20 +412,23 @@ public final class Security * </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 * {@link 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); } /** |