< prev index next >
src/java.base/share/classes/javax/crypto/ExemptionMechanism.java
Print this page
rev 15967 : [mq]: GetInstance
@@ -32,10 +32,11 @@
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,23 +127,23 @@
* <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.
+ * @return the new {@code ExemptionMechanism} object
*
- * @exception NullPointerException if <code>algorithm</code>
- * is null.
+ * @throws NoSuchAlgorithmException if no {@code Provider} supports an
+ * {@code ExemptionMechanismSpi} implementation for the
+ * specified algorithm
*
- * @exception NoSuchAlgorithmException if no Provider supports an
- * 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,30 +168,30 @@
* 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.
+ * @return the new {@code ExemptionMechanism} object
*
- * @exception NullPointerException if <code>algorithm</code>
- * is null.
+ * @throws IllegalArgumentException if the {@code provider}
+ * is {@code null} or empty
*
- * @exception NoSuchAlgorithmException if an ExemptionMechanismSpi
+ * @throws NoSuchAlgorithmException if an {@code ExemptionMechanismSpi}
* implementation for the specified algorithm is not
- * available from the specified provider.
+ * available from the specified provider
*
- * @exception NoSuchProviderException if the specified provider is not
- * registered in the security provider list.
+ * @throws NoSuchProviderException if the specified provider is not
+ * registered in the security provider list
*
- * @exception IllegalArgumentException if the <code>provider</code>
- * is null or empty.
+ * @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,26 +212,26 @@
* 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.
+ * @return the new {@code ExemptionMechanism} object
*
- * @exception NullPointerException if <code>algorithm</code>
- * is null.
+ * @throws IllegalArgumentException if the {@code provider}
+ * is null
*
- * @exception NoSuchAlgorithmException if an ExemptionMechanismSpi
+ * @throws NoSuchAlgorithmException if an {@code ExemptionMechanismSpi}
* implementation for the specified algorithm is not available
- * from the specified Provider object.
+ * from the specified {@code Provider object}
*
- * @exception IllegalArgumentException if the <code>provider</code>
- * is null.
+ * @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 >