< prev index next >

src/java.base/share/classes/javax/crypto/ExemptionMechanism.java

Print this page
rev 15967 : [mq]: GetInstance

*** 32,41 **** --- 32,42 ---- import java.security.NoSuchAlgorithmException; import java.security.NoSuchProviderException; import java.security.InvalidKeyException; import java.security.InvalidAlgorithmParameterException; import java.security.spec.AlgorithmParameterSpec; + import java.util.Objects; import sun.security.jca.GetInstance.Instance; /** * This class provides the functionality of an exemption mechanism, examples
*** 126,148 **** * <a href= * "{@docRoot}/../technotes/guides/security/StandardNames.html#Exemption"> * Java Cryptography Architecture Standard Algorithm Name Documentation</a> * for information about standard exemption mechanism names. * ! * @return the new <code>ExemptionMechanism</code> object. * ! * @exception NullPointerException if <code>algorithm</code> ! * is null. * ! * @exception NoSuchAlgorithmException if no Provider supports an ! * ExemptionMechanismSpi implementation for the ! * specified algorithm. * * @see java.security.Provider */ public static final ExemptionMechanism getInstance(String algorithm) throws NoSuchAlgorithmException { Instance instance = JceSecurity.getInstance("ExemptionMechanism", ExemptionMechanismSpi.class, algorithm); return new ExemptionMechanism((ExemptionMechanismSpi)instance.impl, instance.provider, algorithm); } --- 127,149 ---- * <a href= * "{@docRoot}/../technotes/guides/security/StandardNames.html#Exemption"> * Java Cryptography Architecture Standard Algorithm Name Documentation</a> * for information about standard exemption mechanism names. * ! * @return the new {@code ExemptionMechanism} object * ! * @throws NoSuchAlgorithmException if no {@code Provider} supports an ! * {@code ExemptionMechanismSpi} implementation for the ! * specified algorithm * ! * @throws NullPointerException if {@code algorithm} is {@code null} * * @see java.security.Provider */ public static final ExemptionMechanism getInstance(String algorithm) throws NoSuchAlgorithmException { + Objects.requireNonNull(algorithm, "null algorithm name"); Instance instance = JceSecurity.getInstance("ExemptionMechanism", ExemptionMechanismSpi.class, algorithm); return new ExemptionMechanism((ExemptionMechanismSpi)instance.impl, instance.provider, algorithm); }
*** 167,196 **** * Java Cryptography Architecture Standard Algorithm Name Documentation</a> * for information about standard exemption mechanism names. * * @param provider the name of the provider. * ! * @return the new <code>ExemptionMechanism</code> object. * ! * @exception NullPointerException if <code>algorithm</code> ! * is null. * ! * @exception NoSuchAlgorithmException if an ExemptionMechanismSpi * 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 <code>provider</code> ! * is null or empty. * * @see java.security.Provider */ public static final ExemptionMechanism getInstance(String algorithm, String provider) throws NoSuchAlgorithmException, NoSuchProviderException { Instance instance = JceSecurity.getInstance("ExemptionMechanism", ExemptionMechanismSpi.class, algorithm, provider); return new ExemptionMechanism((ExemptionMechanismSpi)instance.impl, instance.provider, algorithm); } --- 168,197 ---- * Java Cryptography Architecture Standard Algorithm Name Documentation</a> * for information about standard exemption mechanism names. * * @param provider the name of the provider. * ! * @return the new {@code ExemptionMechanism} object * ! * @throws IllegalArgumentException if the {@code provider} ! * is {@code null} or empty * ! * @throws NoSuchAlgorithmException if an {@code ExemptionMechanismSpi} * implementation for the specified algorithm 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 algorithm} is {@code null} * * @see java.security.Provider */ public static final ExemptionMechanism getInstance(String algorithm, String provider) throws NoSuchAlgorithmException, NoSuchProviderException { + Objects.requireNonNull(algorithm, "null algorithm name"); Instance instance = JceSecurity.getInstance("ExemptionMechanism", ExemptionMechanismSpi.class, algorithm, provider); return new ExemptionMechanism((ExemptionMechanismSpi)instance.impl, instance.provider, algorithm); }
*** 211,236 **** * Java Cryptography Architecture Standard Algorithm Name Documentation</a> * for information about standard exemption mechanism names. * * @param provider the provider. * ! * @return the new <code>ExemptionMechanism</code> object. * ! * @exception NullPointerException if <code>algorithm</code> ! * is null. * ! * @exception NoSuchAlgorithmException if an ExemptionMechanismSpi * implementation for the specified algorithm is not available ! * from the specified Provider object. * ! * @exception IllegalArgumentException if the <code>provider</code> ! * is null. * * @see java.security.Provider */ public static final ExemptionMechanism getInstance(String algorithm, Provider provider) throws NoSuchAlgorithmException { Instance instance = JceSecurity.getInstance("ExemptionMechanism", ExemptionMechanismSpi.class, algorithm, provider); return new ExemptionMechanism((ExemptionMechanismSpi)instance.impl, instance.provider, algorithm); } --- 212,237 ---- * Java Cryptography Architecture Standard Algorithm Name Documentation</a> * for information about standard exemption mechanism names. * * @param provider the provider. * ! * @return the new {@code ExemptionMechanism} object * ! * @throws IllegalArgumentException if the {@code provider} ! * is null * ! * @throws NoSuchAlgorithmException if an {@code ExemptionMechanismSpi} * implementation for the specified algorithm is not available ! * from the specified {@code Provider object} * ! * @exception NullPointerException if {@code algorithm} is {@code null} * * @see java.security.Provider */ public static final ExemptionMechanism getInstance(String algorithm, Provider provider) throws NoSuchAlgorithmException { + Objects.requireNonNull(algorithm, "null algorithm name"); Instance instance = JceSecurity.getInstance("ExemptionMechanism", ExemptionMechanismSpi.class, algorithm, provider); return new ExemptionMechanism((ExemptionMechanismSpi)instance.impl, instance.provider, algorithm); }
< prev index next >