< prev index next >

src/java.base/share/classes/java/security/cert/CertificateFactory.java

Print this page
rev 15967 : [mq]: GetInstance

*** 27,40 **** import java.io.InputStream; import java.util.Collection; import java.util.Iterator; import java.util.List; import java.security.Provider; import java.security.Security; - import java.security.AccessController; - import java.security.PrivilegedAction; import java.security.NoSuchAlgorithmException; import java.security.NoSuchProviderException; import sun.security.jca.*; import sun.security.jca.GetInstance.Instance; --- 27,39 ---- import java.io.InputStream; import java.util.Collection; import java.util.Iterator; import java.util.List; + import java.util.Objects; import java.security.Provider; import java.security.Security; import java.security.NoSuchAlgorithmException; import java.security.NoSuchProviderException; import sun.security.jca.*; import sun.security.jca.GetInstance.Instance;
*** 175,194 **** * See the CertificateFactory section in the <a href= * "{@docRoot}/../technotes/guides/security/StandardNames.html#CertificateFactory"> * Java Cryptography Architecture Standard Algorithm Name Documentation</a> * for information about standard certificate types. * ! * @return a certificate factory object for the specified type. * ! * @exception CertificateException if no Provider supports a ! * CertificateFactorySpi implementation for the ! * specified type. * * @see java.security.Provider */ public static final CertificateFactory getInstance(String type) throws CertificateException { try { Instance instance = GetInstance.getInstance("CertificateFactory", CertificateFactorySpi.class, type); return new CertificateFactory((CertificateFactorySpi)instance.impl, instance.provider, type); --- 174,196 ---- * See the CertificateFactory section in the <a href= * "{@docRoot}/../technotes/guides/security/StandardNames.html#CertificateFactory"> * Java Cryptography Architecture Standard Algorithm Name Documentation</a> * for information about standard certificate types. * ! * @return a certificate factory object for the specified type * ! * @throws CertificateException if no {@code Provider} supports a ! * {@code CertificateFactorySpi} implementation for the ! * specified type ! * ! * @throws NullPointerException if {@code type} is {@code null} * * @see java.security.Provider */ public static final CertificateFactory getInstance(String type) throws CertificateException { + Objects.requireNonNull(type, "null type name"); try { Instance instance = GetInstance.getInstance("CertificateFactory", CertificateFactorySpi.class, type); return new CertificateFactory((CertificateFactorySpi)instance.impl, instance.provider, type);
*** 215,241 **** * Java Cryptography Architecture Standard Algorithm Name Documentation</a> * for information about standard certificate types. * * @param provider the name of the provider. * ! * @return a certificate factory object for the specified type. * ! * @exception CertificateException if a CertificateFactorySpi * implementation for the specified algorithm 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 java.security.Provider */ public static final CertificateFactory getInstance(String type, String provider) throws CertificateException, NoSuchProviderException { try { Instance instance = GetInstance.getInstance("CertificateFactory", CertificateFactorySpi.class, type, provider); return new CertificateFactory((CertificateFactorySpi)instance.impl, instance.provider, type); --- 217,246 ---- * Java Cryptography Architecture Standard Algorithm Name Documentation</a> * for information about standard certificate types. * * @param provider the name of the provider. * ! * @return a certificate factory object for the specified type * ! * @throws CertificateException if a {@code CertificateFactorySpi} * implementation for the specified algorithm is not ! * available from the specified provider ! * ! * @throws IllegalArgumentException if the provider name is {@code null} ! * or empty * ! * @throws NoSuchProviderException if the specified provider is not ! * registered in the security provider list * ! * @throws NullPointerException if {@code type} is {@code null} * * @see java.security.Provider */ public static final CertificateFactory getInstance(String type, String provider) throws CertificateException, NoSuchProviderException { + Objects.requireNonNull(type, "null type name"); try { Instance instance = GetInstance.getInstance("CertificateFactory", CertificateFactorySpi.class, type, provider); return new CertificateFactory((CertificateFactorySpi)instance.impl, instance.provider, type);
*** 258,282 **** * "{@docRoot}/../technotes/guides/security/StandardNames.html#CertificateFactory"> * Java Cryptography Architecture Standard Algorithm Name Documentation</a> * for information about standard certificate types. * @param provider the provider. * ! * @return a certificate factory object for the specified type. * ! * @exception CertificateException if a CertificateFactorySpi * implementation for the specified algorithm is not available ! * from the specified Provider object. * ! * @exception IllegalArgumentException if the {@code provider} is ! * null. * * @see java.security.Provider * * @since 1.4 */ public static final CertificateFactory getInstance(String type, Provider provider) throws CertificateException { try { Instance instance = GetInstance.getInstance("CertificateFactory", CertificateFactorySpi.class, type, provider); return new CertificateFactory((CertificateFactorySpi)instance.impl, instance.provider, type); --- 263,290 ---- * "{@docRoot}/../technotes/guides/security/StandardNames.html#CertificateFactory"> * Java Cryptography Architecture Standard Algorithm Name Documentation</a> * for information about standard certificate types. * @param provider the provider. * ! * @return a certificate factory object for the specified type * ! * @throws CertificateException if a {@code CertificateFactorySpi} * implementation for the specified algorithm is not available ! * from the specified {@code Provider} object ! * ! * @throws IllegalArgumentException if the {@code provider} is ! * {@code null} * ! * @throws NullPointerException if {@code type} is {@code null} * * @see java.security.Provider * * @since 1.4 */ public static final CertificateFactory getInstance(String type, Provider provider) throws CertificateException { + Objects.requireNonNull(type, "null type name"); try { Instance instance = GetInstance.getInstance("CertificateFactory", CertificateFactorySpi.class, type, provider); return new CertificateFactory((CertificateFactorySpi)instance.impl, instance.provider, type);
< prev index next >