From 3d102c3741af065f1dd1ff0e87cdaf897b1b62a9 Mon Sep 17 00:00:00 2001 From: mark Date: Sun, 17 Nov 2002 00:10:24 +0000 Subject: 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@59179 138bc75d-0d04-0410-961f-82ee72b054a4 --- libjava/java/security/Provider.java | 49 +++++++++++++++++++++++++++++++------ 1 file changed, 41 insertions(+), 8 deletions(-) (limited to 'libjava/java/security/Provider.java') diff --git a/libjava/java/security/Provider.java b/libjava/java/security/Provider.java index d3e3581891e..c40a980aaa3 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. + *

+ * NOT IMPLEMENTED YET[ + * First, if there is a security manager, its checkSecurityAccess + * 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 checkSecurityAccess is used + * (that is, that method is not overriden), then this results in a call to the + * security manager's checkPermission method with a + * SecurityPermission("putProviderProperty."+name) + * permission.
] * - * @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 null if no previous value. + * @return The previous value of the specified property (key), + * or null 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 null if no previous value. + * @return The previous value for this key, or null 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; + } } -- cgit v1.2.3