This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

KeyStore patch


Hi,

the attached patch deletes some inconsistency with jdk1.4 in 
java/security/KeyStore.java. Can someone please apply it. Thanks.

Jörg

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.

*** KeyStore.java.orig	Mon Nov 18 13:21:23 2002
--- KeyStore.java	Mon Nov 18 13:36:10 2002
*************** public class KeyStore
*** 92,100 ****
    /** 
       Gets an instance of the KeyStore class representing
       the specified keystore. If the type is not 
!      found then, it throws CertificateException.
  
!      @param type the type of certificate to choose
  
       @return a KeyStore repesenting the desired type
  
--- 92,100 ----
    /** 
       Gets an instance of the KeyStore class representing
       the specified keystore. If the type is not 
!      found then, it throws KeyStoreException.
  
!      @param type the type of keystore to choose
  
       @return a KeyStore repesenting the desired type
  
*************** public class KeyStore
*** 117,141 ****
    /** 
       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 provider is not found, then it throws 
       NoSuchProviderException.
  
!      @param type the type of certificate to choose
  
       @return a KeyStore repesenting the desired type
  
!      @throws KeyStoreException if the type of keystore is not implemented by providers
       @throws NoSuchProviderException if the provider is not found
     */
    public static KeyStore getInstance(String type, String provider)
      throws KeyStoreException, NoSuchProviderException
    {
      Provider p = Security.getProvider(provider);
      if (p == null)
        throw new NoSuchProviderException();
  
      return getInstance(p.getProperty("KeyStore." + type), type, p);
    }
  
    private static KeyStore getInstance(String classname,
--- 117,173 ----
    /** 
       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 provider name
  
       @return a KeyStore repesenting the desired type
  
!      @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();
  
      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 IllegalArgumentException("Illegal provider");
+ 
+     return getInstance(provider.getProperty("KeyStore." + type), type, provider);
    }
  
    private static KeyStore getInstance(String classname,


__________________________________________________________________

Gesendet von Yahoo! Mail - http://mail.yahoo.de
Möchten Sie mit einem Gruß antworten? http://grusskarten.yahoo.de


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]