< prev index next >
src/java.base/share/classes/javax/net/ssl/TrustManagerFactory.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 trust managers based on a
@@ -142,21 +143,23 @@
* algorithm. 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>TrustManagerFactory</code> object.
+ * @return the new {@code TrustManagerFactory} object
*
- * @exception NoSuchAlgorithmException if no Provider supports a
- * TrustManagerFactorySpi implementation for the
- * specified algorithm.
- * @exception NullPointerException if algorithm is null.
+ * @throws NoSuchAlgorithmException if no {@code Provider} supports a
+ * {@code TrustManagerFactorySpi} implementation for the
+ * specified algorithm
+ *
+ * @throws NullPointerException if {@code algorithm} is {@code null}
*
* @see java.security.Provider
*/
public static final TrustManagerFactory getInstance(String algorithm)
throws NoSuchAlgorithmException {
+ Objects.requireNonNull(algorithm, "null algorithm name");
GetInstance.Instance instance = GetInstance.getInstance
("TrustManagerFactory", TrustManagerFactorySpi.class,
algorithm);
return new TrustManagerFactory((TrustManagerFactorySpi)instance.impl,
instance.provider, algorithm);
@@ -180,27 +183,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>TrustManagerFactory</code> object
+ * @return the new {@code TrustManagerFactory} object
+ *
+ * @throws IllegalArgumentException if the provider name is
+ * {@code null} or empty
*
- * @throws NoSuchAlgorithmException if a TrustManagerFactorySpi
+ * @throws NoSuchAlgorithmException if a {@code TrustManagerFactorySpi}
* 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 algorithm is null.
+ * @throws NullPointerException if {@code algorithm} is {@code null}
*
* @see java.security.Provider
*/
public static final TrustManagerFactory getInstance(String algorithm,
String provider) throws NoSuchAlgorithmException,
NoSuchProviderException {
+ Objects.requireNonNull(algorithm, "null algorithm name");
GetInstance.Instance instance = GetInstance.getInstance
("TrustManagerFactory", TrustManagerFactorySpi.class,
algorithm, provider);
return new TrustManagerFactory((TrustManagerFactorySpi)instance.impl,
instance.provider, algorithm);
@@ -221,23 +227,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>TrustManagerFactory</code> object.
+ * @return the new {@code TrustManagerFactory} object
+ *
+ * @throws IllegalArgumentException if the provider is {@code null}
*
- * @throws NoSuchAlgorithmException if a TrustManagerFactorySpi
+ * @throws NoSuchAlgorithmException if a {@code TrustManagerFactorySpi}
* implementation for the specified algorithm is not available
- * from the specified Provider object.
+ * from the specified {@code Provider} object
*
- * @throws IllegalArgumentException if the provider is null.
- * @throws NullPointerException if algorithm is null.
+ * @throws NullPointerException if {@code algorithm} is {@code null}
*
* @see java.security.Provider
*/
public static final TrustManagerFactory getInstance(String algorithm,
Provider provider) throws NoSuchAlgorithmException {
+ Objects.requireNonNull(algorithm, "null algorithm name");
GetInstance.Instance instance = GetInstance.getInstance
("TrustManagerFactory", TrustManagerFactorySpi.class,
algorithm, provider);
return new TrustManagerFactory((TrustManagerFactorySpi)instance.impl,
instance.provider, algorithm);
< prev index next >