This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
KeyStore patch
- From: Joerg Brunsmann <joerg_brunsmann at yahoo dot de>
- To: java-patches at gcc dot gnu dot org
- Date: Mon, 18 Nov 2002 13:44:37 +0100 (CET)
- Subject: 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