]> gcc.gnu.org Git - gcc.git/commitdiff
KeyStore.java (getInstance): Fix comment and throw IllegalArgumentException if given...
authorJoerg Brunsmann <joerg_brunsmann@yahoo.de>
Mon, 18 Nov 2002 18:09:35 +0000 (18:09 +0000)
committerTom Tromey <tromey@gcc.gnu.org>
Mon, 18 Nov 2002 18:09:35 +0000 (18:09 +0000)
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.

From-SVN: r59226

libjava/ChangeLog
libjava/java/security/KeyStore.java

index 9f462c3caf2cfb41ba0fedd9047fee997c2cdf5d..bc8774b6a004d867d300046dafe28976d02c0107 100644 (file)
@@ -1,3 +1,10 @@
+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.
+
 2002-11-18  Michael Koch <konqueror@gmx.de>
 
        * java/net/PlainSocketImpl.java: Fix imports.
index e7c80716c407ed20b3721be6e104cdfa174b6e2e..1627bc5610a06fc292b8dfad7e166a1693bc81e2 100644 (file)
@@ -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)
This page took 0.0714939999999999 seconds and 5 git commands to generate.