< prev index next >
src/java.base/share/classes/java/security/KeyPairGenerator.java
Print this page
rev 15967 : [mq]: GetInstance
@@ -207,20 +207,23 @@
* See the KeyPairGenerator section in the <a href=
* "{@docRoot}/../technotes/guides/security/StandardNames.html#KeyPairGenerator">
* Java Cryptography Architecture Standard Algorithm Name Documentation</a>
* for information about standard algorithm names.
*
- * @return the new KeyPairGenerator object.
+ * @return the new {@code KeyPairGenerator} object
*
- * @exception NoSuchAlgorithmException if no Provider supports a
- * KeyPairGeneratorSpi implementation for the
- * specified algorithm.
+ * @throws NoSuchAlgorithmException if no {@code Provider} supports a
+ * {@code KeyPairGeneratorSpi} implementation for the
+ * specified algorithm
+ *
+ * @throws NullPointerException if {@code algorithm} is {@code null}
*
* @see Provider
*/
public static KeyPairGenerator getInstance(String algorithm)
throws NoSuchAlgorithmException {
+ Objects.requireNonNull(algorithm, "null algorithm name");
List<Service> list =
GetInstance.getServices("KeyPairGenerator", algorithm);
Iterator<Service> t = list.iterator();
if (t.hasNext() == false) {
throw new NoSuchAlgorithmException
@@ -265,27 +268,30 @@
* 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 KeyPairGenerator object.
+ * @return the new {@code KeyPairGenerator} object
+ *
+ * @throws IllegalArgumentException if the provider name is {@code null}
+ * or empty
*
- * @exception NoSuchAlgorithmException if a KeyPairGeneratorSpi
+ * @throws NoSuchAlgorithmException if a {@code KeyPairGeneratorSpi}
* 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 KeyPairGenerator getInstance(String algorithm,
String provider)
throws NoSuchAlgorithmException, NoSuchProviderException {
+ Objects.requireNonNull(algorithm, "null algorithm name");
Instance instance = GetInstance.getInstance("KeyPairGenerator",
KeyPairGeneratorSpi.class, algorithm, provider);
return getInstance(instance, algorithm);
}
@@ -304,24 +310,28 @@
* Java Cryptography Architecture Standard Algorithm Name Documentation</a>
* for information about standard algorithm names.
*
* @param provider the provider.
*
- * @return the new KeyPairGenerator object.
+ * @return the new {@code KeyPairGenerator} object
+ *
+ * @throws IllegalArgumentException if the specified provider is
+ * {@code null}
*
- * @exception NoSuchAlgorithmException if a KeyPairGeneratorSpi
+ * @throws NoSuchAlgorithmException if a {@code KeyPairGeneratorSpi}
* 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 KeyPairGenerator getInstance(String algorithm,
Provider provider) throws NoSuchAlgorithmException {
+ Objects.requireNonNull(algorithm, "null algorithm name");
Instance instance = GetInstance.getInstance("KeyPairGenerator",
KeyPairGeneratorSpi.class, algorithm, provider);
return getInstance(instance, algorithm);
}
< prev index next >