< prev index next >

src/java.base/share/classes/java/security/KeyStore.java

Print this page
rev 15967 : [mq]: GetInstance

*** 24,34 **** */ package java.security; import java.io.*; - import java.net.URI; import java.security.cert.Certificate; import java.security.cert.X509Certificate; import java.security.cert.CertificateException; import java.security.spec.AlgorithmParameterSpec; import java.util.*; --- 24,33 ----
*** 853,873 **** * See the KeyStore section in the <a href= * "{@docRoot}/../technotes/guides/security/StandardNames.html#KeyStore"> * Java Cryptography Architecture Standard Algorithm Name Documentation</a> * for information about standard keystore types. * ! * @return a keystore object of the specified type. * ! * @exception KeyStoreException if no Provider supports a ! * KeyStoreSpi implementation for the ! * specified type. * * @see Provider */ public static KeyStore getInstance(String type) throws KeyStoreException { try { Object[] objs = Security.getImpl(type, "KeyStore", (String)null); return new KeyStore((KeyStoreSpi)objs[0], (Provider)objs[1], type); } catch (NoSuchAlgorithmException nsae) { throw new KeyStoreException(type + " not found", nsae); --- 852,875 ---- * See the KeyStore section in the <a href= * "{@docRoot}/../technotes/guides/security/StandardNames.html#KeyStore"> * Java Cryptography Architecture Standard Algorithm Name Documentation</a> * for information about standard keystore types. * ! * @return a keystore object of the specified type * ! * @throws KeyStoreException if no {@code Provider} supports a ! * {@code KeyStoreSpi} implementation for the ! * specified type ! * ! * @throws NullPointerException if {@code type} is {@code null} * * @see Provider */ public static KeyStore getInstance(String type) throws KeyStoreException { + Objects.requireNonNull(type, "null type name"); try { Object[] objs = Security.getImpl(type, "KeyStore", (String)null); return new KeyStore((KeyStoreSpi)objs[0], (Provider)objs[1], type); } catch (NoSuchAlgorithmException nsae) { throw new KeyStoreException(type + " not found", nsae);
*** 893,919 **** * Java Cryptography Architecture Standard Algorithm Name Documentation</a> * for information about standard keystore types. * * @param provider the name of the provider. * ! * @return a keystore object of the specified type. * ! * @exception KeyStoreException if a KeyStoreSpi * implementation for the specified type is not ! * available from the specified provider. * ! * @exception NoSuchProviderException if the specified provider is not ! * registered in the security provider list. * ! * @exception IllegalArgumentException if the provider name is null ! * or empty. * * @see Provider */ public static KeyStore getInstance(String type, String provider) throws KeyStoreException, NoSuchProviderException { if (provider == null || provider.length() == 0) throw new IllegalArgumentException("missing provider"); try { Object[] objs = Security.getImpl(type, "KeyStore", provider); return new KeyStore((KeyStoreSpi)objs[0], (Provider)objs[1], type); --- 895,924 ---- * Java Cryptography Architecture Standard Algorithm Name Documentation</a> * for information about standard keystore types. * * @param provider the name of the provider. * ! * @return a keystore object of the specified type ! * ! * @throws IllegalArgumentException if the provider name is {@code null} ! * or empty * ! * @throws KeyStoreException if a {@code KeyStoreSpi} * implementation for the specified type is not ! * available from the specified provider * ! * @throws NoSuchProviderException if the specified provider is not ! * registered in the security provider list * ! * @throws NullPointerException if {@code type} is {@code null} * * @see Provider */ public static KeyStore getInstance(String type, String provider) throws KeyStoreException, NoSuchProviderException { + Objects.requireNonNull(type, "null type name"); if (provider == null || provider.length() == 0) throw new IllegalArgumentException("missing provider"); try { Object[] objs = Security.getImpl(type, "KeyStore", provider); return new KeyStore((KeyStoreSpi)objs[0], (Provider)objs[1], type);
*** 936,960 **** * Java Cryptography Architecture Standard Algorithm Name Documentation</a> * for information about standard keystore types. * * @param provider the provider. * ! * @return a keystore object of the specified type. * ! * @exception KeyStoreException if KeyStoreSpi * implementation for the specified type is not available ! * from the specified Provider object. * ! * @exception IllegalArgumentException if the specified provider is null. * * @see Provider * * @since 1.4 */ public static KeyStore getInstance(String type, Provider provider) throws KeyStoreException { if (provider == null) throw new IllegalArgumentException("missing provider"); try { Object[] objs = Security.getImpl(type, "KeyStore", provider); return new KeyStore((KeyStoreSpi)objs[0], (Provider)objs[1], type); --- 941,969 ---- * Java Cryptography Architecture Standard Algorithm Name Documentation</a> * for information about standard keystore types. * * @param provider the provider. * ! * @return a keystore object of the specified type ! * ! * @throws IllegalArgumentException if the specified provider is ! * {@code null} * ! * @throws KeyStoreException if {@code KeyStoreSpi} * implementation for the specified type is not available ! * from the specified {@code Provider} object * ! * @throws NullPointerException if {@code type} is {@code null} * * @see Provider * * @since 1.4 */ public static KeyStore getInstance(String type, Provider provider) throws KeyStoreException { + Objects.requireNonNull(type, "null type name"); if (provider == null) throw new IllegalArgumentException("missing provider"); try { Object[] objs = Security.getImpl(type, "KeyStore", provider); return new KeyStore((KeyStoreSpi)objs[0], (Provider)objs[1], type);
< prev index next >