diff options
author | Mark Wielaard <mark@klomp.org> | 2002-11-17 00:10:24 +0000 |
---|---|---|
committer | Mark Wielaard <mark@gcc.gnu.org> | 2002-11-17 00:10:24 +0000 |
commit | b0fc58713dc5c60f3a0bbe792124c37eb97d5d5a (patch) | |
tree | 413f3dd029186270eae12c491b26ff3d1f283b4e /libjava/java/security/Provider.java | |
parent | aaefd21647444a82468b8bc3ef6c65721ef18598 (diff) | |
download | gcc-b0fc58713dc5c60f3a0bbe792124c37eb97d5d5a.zip gcc-b0fc58713dc5c60f3a0bbe792124c37eb97d5d5a.tar.gz gcc-b0fc58713dc5c60f3a0bbe792124c37eb97d5d5a.tar.bz2 |
Integrate work by Raif S.
Integrate work by Raif S. Naffah (raif@fl.net.au)
* java/security/DummyKeyPairGenerator.java (clone): New method.
* java/security/DummyMessageDigest.java (clone): New method.
(engineUpdate): Now public.
(engineReset): Likewise.
(engineDigest): Likewise.
(engineGetDigestLength): New method.
* java/security/DummySignature.java (clone): New method.
* java/security/KeyPairGenerator.java (provider): Now package private.
(getInstance(String)): Use getInstance(String,Provider).
(getInstance(String,String): Use getInstance(String,Provider)
(getInstance(String,Provider): New method.
(getInstance(String,String,Provider): Don't cast DummyKeyPairGenerator.
* java/security/KeyPairGeneratorSpi.java (clone): New method.
* java/security/MessageDigest.java (provider): Now package private.
(getInstance(String): Use getInstance(String,Provider).
(getInstance(String,String): Use getInstance(String,Provider)
(getInstance(String,Provider): New method.
* java/security/Provider.java (toCanonicalKey): New method.
(get): New method that uses toCanonicalKey().
(put): Use toCanonicalKey().
(remove): Likewise.
* java/security/Security.java (insertProviderAt): Provider index is one
based, not zero based.
(addProvider): Likewise.
(removeProvider): Likewise.
* java/security/Signature.java (provider): Now package private.
(getInstance(String)): Use getInstance(String,Provider).
(getInstance(String,String): Use getInstance(String,Provider)
(getInstance(String,Provider): New method.
(getInstance(String,String,Provider): Don't cast DummySignature.
From-SVN: r59179
Diffstat (limited to 'libjava/java/security/Provider.java')
-rw-r--r-- | libjava/java/security/Provider.java | 49 |
1 files changed, 41 insertions, 8 deletions
diff --git a/libjava/java/security/Provider.java b/libjava/java/security/Provider.java index d3e3581..c40a980 100644 --- a/libjava/java/security/Provider.java +++ b/libjava/java/security/Provider.java @@ -1,5 +1,5 @@ /* Provider.java -- Security provider information - Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc. + Copyright (C) 1998, 1999, 2000, 2002 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -119,16 +119,40 @@ public abstract class Provider extends Properties implements Serializable } /** - * This method sets the specified key to have the specified value. + * Sets the key property to have the specified value. + * <p> + * <bold>NOT IMPLEMENTED YET</bold>[ + * First, if there is a security manager, its <code>checkSecurityAccess</code> + * method is called with the string "putProviderProperty."+name, where name is + * the provider name, to see if it's ok to set this provider's property + * values. + * If the default implementation of <code>checkSecurityAccess</code> is used + * (that is, that method is not overriden), then this results in a call to the + * security manager's <code>checkPermission</code> method with a + * <code>SecurityPermission("putProviderProperty."+name)</code> + * permission.<br>] * - * @param key The property key - * @param value The property value + * @param key The property key. + * @param value The property value. * - * @return The previous value for this key, or <code>null</code> if no previous value. + * @return The previous value of the specified property (<code>key</code>), + * or <code>null</code> if it did not have one. + * @throws SecurityException If a security manager exists and its + * {@link java.lang.SecurityManager.checkSecurityAccess(java.lang.String)} + * method denies access to set property values. + * @since Classpath 0.4+cvs, JDK 1.2 + * @see java.lang.Object.equals(Object) + * @see java.util.Hashtable.get(Object) */ public Object put(Object key, Object value) { - return (super.put(key, value)); + return super.put(toCanonicalKey(key), value); + } + + // overrides same in java.util.Hashtable + public Object get(Object key) + { + return super.get(toCanonicalKey(key)); } /** @@ -137,11 +161,12 @@ public abstract class Provider extends Properties implements Serializable * * @param key The key to remove * - * @return The previous value for this key, or <code>null</code> if no previous value. + * @return The previous value for this key, or <code>null</code> if no + * previous value. */ public Object remove(Object key) { - return (super.remove(key)); + return super.remove(toCanonicalKey(key)); } /** @@ -166,4 +191,12 @@ public abstract class Provider extends Properties implements Serializable return (getClass().getName() + ": name=" + getName() + " version=" + version); } + + private Object toCanonicalKey(Object key) + { + if (key.getClass().isAssignableFrom(String.class)) // is it ours? + return ((String) key).toUpperCase(); // use default locale + else + return key; + } } |