< prev index next >
src/java.base/share/classes/java/security/AlgorithmParameterGenerator.java
Print this page
rev 15967 : [mq]: GetInstance
@@ -24,10 +24,11 @@
*/
package java.security;
import java.security.spec.AlgorithmParameterSpec;
+import java.util.Objects;
/**
* The {@code AlgorithmParameterGenerator} class is used to generate a
* set of
* parameters to be used with a certain algorithm. Parameter generators
@@ -151,20 +152,23 @@
* See the AlgorithmParameterGenerator section in the <a href=
* "{@docRoot}/../technotes/guides/security/StandardNames.html#AlgorithmParameterGenerator">
* Java Cryptography Architecture Standard Algorithm Name Documentation</a>
* for information about standard algorithm names.
*
- * @return the new AlgorithmParameterGenerator object.
+ * @return the new {@code AlgorithmParameterGenerator} object
*
- * @exception NoSuchAlgorithmException if no Provider supports an
- * AlgorithmParameterGeneratorSpi implementation for the
- * specified algorithm.
+ * @throws NoSuchAlgorithmException if no {@code Provider} supports an
+ * {@code AlgorithmParameterGeneratorSpi} implementation for the
+ * specified algorithm
+ *
+ * @throws NullPointerException if {@code algorithm} is {@code null}
*
* @see Provider
*/
public static AlgorithmParameterGenerator getInstance(String algorithm)
throws NoSuchAlgorithmException {
+ Objects.requireNonNull(algorithm, "null algorithm name");
try {
Object[] objs = Security.getImpl(algorithm,
"AlgorithmParameterGenerator",
(String)null);
return new AlgorithmParameterGenerator
@@ -195,28 +199,32 @@
* Java Cryptography Architecture Standard Algorithm Name Documentation</a>
* for information about standard algorithm names.
*
* @param provider the string name of the Provider.
*
- * @return the new AlgorithmParameterGenerator object.
+ * @return the new {@code AlgorithmParameterGenerator} object
+ *
+ * @throws IllegalArgumentException if the provider name is {@code null}
+ * or empty
*
- * @exception NoSuchAlgorithmException if an AlgorithmParameterGeneratorSpi
+ * @throws NoSuchAlgorithmException if an
+ * {@code AlgorithmParameterGeneratorSpi}
* 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 provider name is null
- * or empty.
+ * @throws NullPointerException if {@code algorithm} is {@code null}
*
* @see Provider
*/
public static AlgorithmParameterGenerator getInstance(String algorithm,
String provider)
throws NoSuchAlgorithmException, NoSuchProviderException
{
+ Objects.requireNonNull(algorithm, "null algorithm name");
if (provider == null || provider.length() == 0)
throw new IllegalArgumentException("missing provider");
Object[] objs = Security.getImpl(algorithm,
"AlgorithmParameterGenerator",
provider);
@@ -239,28 +247,33 @@
* See the AlgorithmParameterGenerator section in the <a href=
* "{@docRoot}/../technotes/guides/security/StandardNames.html#AlgorithmParameterGenerator">
* Java Cryptography Architecture Standard Algorithm Name Documentation</a>
* for information about standard algorithm names.
*
- * @param provider the Provider object.
+ * @param provider the {@code Provider} object.
+ *
+ * @return the new {@code AlgorithmParameterGenerator} object
*
- * @return the new AlgorithmParameterGenerator object.
+ * @throws IllegalArgumentException if the specified provider is
+ * {@code null}
*
- * @exception NoSuchAlgorithmException if an AlgorithmParameterGeneratorSpi
+ * @throws NoSuchAlgorithmException if an
+ * {@code AlgorithmParameterGeneratorSpi}
* implementation for the specified algorithm is not available
- * from the specified Provider object.
+ * from the specified {@code Provider} object
*
- * @exception IllegalArgumentException if the specified provider is null.
+ * @throws NullPointerException if {@code algorithm} is {@code null}
*
* @see Provider
*
* @since 1.4
*/
public static AlgorithmParameterGenerator getInstance(String algorithm,
Provider provider)
throws NoSuchAlgorithmException
{
+ Objects.requireNonNull(algorithm, "null algorithm name");
if (provider == null)
throw new IllegalArgumentException("missing provider");
Object[] objs = Security.getImpl(algorithm,
"AlgorithmParameterGenerator",
provider);
< prev index next >