< prev index next >
src/java.base/share/classes/javax/net/ssl/KeyManagerFactory.java
Print this page
rev 15967 : [mq]: GetInstance
@@ -25,10 +25,11 @@
package javax.net.ssl;
import java.security.Security;
import java.security.*;
+import java.util.Objects;
import sun.security.jca.GetInstance;
/**
* This class acts as a factory for key managers based on a
@@ -128,21 +129,23 @@
* See the <a href=
* "{@docRoot}/../technotes/guides/security/jsse/JSSERefGuide.html">
* Java Secure Socket Extension Reference Guide </a>
* for information about standard algorithm names.
*
- * @return the new <code>KeyManagerFactory</code> object.
+ * @return the new {@code KeyManagerFactory} object
*
- * @exception NoSuchAlgorithmException if no Provider supports a
- * KeyManagerFactorySpi implementation for the
- * specified algorithm.
- * @exception NullPointerException if <code>algorithm</code> is null.
+ * @throws NoSuchAlgorithmException if no {@code Provider} supports a
+ * {@code KeyManagerFactorySpi} implementation for the
+ * specified algorithm
+ *
+ * @throws NullPointerException if {@code algorithm} is {@code null}
*
* @see java.security.Provider
*/
public static final KeyManagerFactory getInstance(String algorithm)
throws NoSuchAlgorithmException {
+ Objects.requireNonNull(algorithm, "null algorithm name");
GetInstance.Instance instance = GetInstance.getInstance
("KeyManagerFactory", KeyManagerFactorySpi.class,
algorithm);
return new KeyManagerFactory((KeyManagerFactorySpi)instance.impl,
instance.provider, algorithm);
@@ -166,27 +169,30 @@
* Java Secure Socket Extension Reference Guide </a>
* for information about standard algorithm names.
*
* @param provider the name of the provider.
*
- * @return the new <code>KeyManagerFactory</code> object.
+ * @return the new {@code KeyManagerFactory} object
+ *
+ * @throws IllegalArgumentException if the provider name is {@code null}
+ * or empty
*
- * @throws NoSuchAlgorithmException if a KeyManagerFactorySpi
+ * @throws NoSuchAlgorithmException if a {@code KeyManagerFactorySpi}
* implementation for the specified algorithm is not
- * available from the specified provider.
+ * available from the specified provider
*
* @throws NoSuchProviderException if the specified provider is not
- * registered in the security provider list.
+ * registered in the security provider list
*
- * @throws IllegalArgumentException if the provider name is null or empty.
- * @throws NullPointerException if <code>algorithm</code> is null.
+ * @throws NullPointerException if {@code algorithm} is {@code null}
*
* @see java.security.Provider
*/
public static final KeyManagerFactory getInstance(String algorithm,
String provider) throws NoSuchAlgorithmException,
NoSuchProviderException {
+ Objects.requireNonNull(algorithm, "null algorithm name");
GetInstance.Instance instance = GetInstance.getInstance
("KeyManagerFactory", KeyManagerFactorySpi.class,
algorithm, provider);
return new KeyManagerFactory((KeyManagerFactorySpi)instance.impl,
instance.provider, algorithm);
@@ -207,23 +213,25 @@
* Java Secure Socket Extension Reference Guide </a>
* for information about standard algorithm names.
*
* @param provider an instance of the provider.
*
- * @return the new <code>KeyManagerFactory</code> object.
+ * @return the new {@code KeyManagerFactory} object
+ *
+ * @throws IllegalArgumentException if provider is {@code null}
*
- * @throws NoSuchAlgorithmException if a KeyManagerFactorySpi
+ * @throws NoSuchAlgorithmException if a {@code @KeyManagerFactorySpi}
* implementation for the specified algorithm is not available
- * from the specified Provider object.
+ * from the specified Provider object
*
- * @throws IllegalArgumentException if provider is null.
- * @throws NullPointerException if <code>algorithm</code> is null.
+ * @throws NullPointerException if {@code algorithm} is {@code null}
*
* @see java.security.Provider
*/
public static final KeyManagerFactory getInstance(String algorithm,
Provider provider) throws NoSuchAlgorithmException {
+ Objects.requireNonNull(algorithm, "null algorithm name");
GetInstance.Instance instance = GetInstance.getInstance
("KeyManagerFactory", KeyManagerFactorySpi.class,
algorithm, provider);
return new KeyManagerFactory((KeyManagerFactorySpi)instance.impl,
instance.provider, algorithm);
< prev index next >