diff options
author | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-11-18 18:09:35 +0000 |
---|---|---|
committer | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-11-18 18:09:35 +0000 |
commit | 7f6d1fcaa3dbfde5fe1abccbd153691c61378233 (patch) | |
tree | 10a142e469fd4fab5b4d57cd7d58f9ed3bafa892 /libjava/java/security/KeyStore.java | |
parent | e2da15d6ed0d22f6dfd29d4de35d2bbb831a7b1f (diff) | |
download | ppe42-gcc-7f6d1fcaa3dbfde5fe1abccbd153691c61378233.tar.gz ppe42-gcc-7f6d1fcaa3dbfde5fe1abccbd153691c61378233.zip |
2002-11-18 Joerg Brunsmann <joerg_brunsmann@yahoo.de>
* java/security/KeyStore.java (getInstance): Fix
comment and throw IllegalArgumentException if
given provider is null.
(getInstance): New method for jdk1.4 compatibility.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@59226 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/java/security/KeyStore.java')
-rw-r--r-- | libjava/java/security/KeyStore.java | 45 |
1 files changed, 39 insertions, 6 deletions
diff --git a/libjava/java/security/KeyStore.java b/libjava/java/security/KeyStore.java index e7c80716c40..1627bc5610a 100644 --- a/libjava/java/security/KeyStore.java +++ b/libjava/java/security/KeyStore.java @@ -1,5 +1,5 @@ /* KeyStore.java --- Key Store Class - Copyright (C) 1999 Free Software Foundation, Inc. + Copyright (C) 1999, 2002 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -92,9 +92,9 @@ public class KeyStore /** Gets an instance of the KeyStore class representing the specified keystore. If the type is not - found then, it throws CertificateException. + found then, it throws KeyStoreException. - @param type the type of certificate to choose + @param type the type of keystore to choose @return a KeyStore repesenting the desired type @@ -117,20 +117,26 @@ public class KeyStore /** Gets an instance of the KeyStore class representing the specified key store from the specified provider. - If the type is not found then, it throws CertificateException. + If the type is not found then, it throws KeyStoreException. If the provider is not found, then it throws NoSuchProviderException. - @param type the type of certificate to choose + @param type the type of keystore to choose + @param provider the provider name @return a KeyStore repesenting the desired type - @throws KeyStoreException if the type of keystore is not implemented by providers + @throws KeyStoreException if the type of keystore is not + implemented by the given provider @throws NoSuchProviderException if the provider is not found + @throws IllegalArgumentException if the provider string is + null or empty */ public static KeyStore getInstance(String type, String provider) throws KeyStoreException, NoSuchProviderException { + if (provider == null || provider.length() == 0) + throw new IllegalArgumentException("Illegal provider"); Provider p = Security.getProvider(provider); if (p == null) throw new NoSuchProviderException(); @@ -138,6 +144,33 @@ public class KeyStore return getInstance(p.getProperty("KeyStore." + type), type, p); } + /** + Gets an instance of the KeyStore class representing + the specified key store from the specified provider. + If the type is not found then, it throws KeyStoreException. + If the provider is not found, then it throws + NoSuchProviderException. + + @param type the type of keystore to choose + @param provider the keystore provider + + @return a KeyStore repesenting the desired type + + @throws KeyStoreException if the type of keystore is not + implemented by the given provider + @throws IllegalArgumentException if the provider object is null + @since 1.4 + */ + public static KeyStore getInstance(String type, Provider provider) + throws KeyStoreException + { + if (provider == null) + throw new IllegalArgumentException("Illegal provider"); + + return getInstance(provider.getProperty("KeyStore." + type), + type, provider); + } + private static KeyStore getInstance(String classname, String type, Provider provider) |