< prev index next >

src/java.base/share/classes/javax/net/ssl/SSLContext.java

Print this page
rev 15967 : [mq]: GetInstance

*** 24,33 **** --- 24,34 ---- */ package javax.net.ssl; import java.security.*; + import java.util.Objects; import sun.security.jca.GetInstance; /** * Instances of this class represent a secure socket protocol
*** 149,169 **** * "{@docRoot}/../technotes/guides/security/StandardNames.html#SSLContext"> * Java Cryptography Architecture Standard Algorithm Name * Documentation</a> * for information about standard protocol names. * ! * @return the new {@code SSLContext} object. * ! * @exception NoSuchAlgorithmException if no Provider supports a ! * SSLContextSpi implementation for the ! * specified protocol. ! * @exception NullPointerException if protocol is null. * * @see java.security.Provider */ public static SSLContext getInstance(String protocol) throws NoSuchAlgorithmException { GetInstance.Instance instance = GetInstance.getInstance ("SSLContext", SSLContextSpi.class, protocol); return new SSLContext((SSLContextSpi)instance.impl, instance.provider, protocol); } --- 150,172 ---- * "{@docRoot}/../technotes/guides/security/StandardNames.html#SSLContext"> * Java Cryptography Architecture Standard Algorithm Name * Documentation</a> * for information about standard protocol names. * ! * @return the new {@code SSLContext} object * ! * @throws NoSuchAlgorithmException if no {@code Provider} supports a ! * {@code SSLContextSpi} implementation for the ! * specified protocol ! * ! * @throws NullPointerException if {@code protocol} is {@code null} * * @see java.security.Provider */ public static SSLContext getInstance(String protocol) throws NoSuchAlgorithmException { + Objects.requireNonNull(protocol, "null protocol name"); GetInstance.Instance instance = GetInstance.getInstance ("SSLContext", SSLContextSpi.class, protocol); return new SSLContext((SSLContextSpi)instance.impl, instance.provider, protocol); }
*** 187,212 **** * Documentation</a> * for information about standard protocol names. * * @param provider the name of the provider. * ! * @return the new {@code SSLContext} object. * ! * @throws NoSuchAlgorithmException if a SSLContextSpi * implementation for the specified protocol is not ! * available from the specified provider. * * @throws NoSuchProviderException if the specified provider is not ! * registered in the security provider list. * ! * @throws IllegalArgumentException if the provider name is null or empty. ! * @throws NullPointerException if protocol is null. * * @see java.security.Provider */ public static SSLContext getInstance(String protocol, String provider) throws NoSuchAlgorithmException, NoSuchProviderException { GetInstance.Instance instance = GetInstance.getInstance ("SSLContext", SSLContextSpi.class, protocol, provider); return new SSLContext((SSLContextSpi)instance.impl, instance.provider, protocol); } --- 190,218 ---- * Documentation</a> * for information about standard protocol names. * * @param provider the name of the provider. * ! * @return the new {@code SSLContext} object ! * ! * @throws IllegalArgumentException if the provider name is ! * {@code null} or empty * ! * @throws NoSuchAlgorithmException if a {@code SSLContextSpi} * implementation for the specified protocol is not ! * available from the specified provider * * @throws NoSuchProviderException if the specified provider is not ! * registered in the security provider list * ! * @throws NullPointerException if {@code protocol} is {@code null} * * @see java.security.Provider */ public static SSLContext getInstance(String protocol, String provider) throws NoSuchAlgorithmException, NoSuchProviderException { + Objects.requireNonNull(protocol, "null protocol name"); GetInstance.Instance instance = GetInstance.getInstance ("SSLContext", SSLContextSpi.class, protocol, provider); return new SSLContext((SSLContextSpi)instance.impl, instance.provider, protocol); }
*** 227,249 **** * Documentation</a> * for information about standard protocol names. * * @param provider an instance of the provider. * ! * @return the new {@code SSLContext} object. * ! * @throws NoSuchAlgorithmException if a SSLContextSpi * implementation for the specified protocol is not available ! * from the specified Provider object. * ! * @throws IllegalArgumentException if the provider is null. ! * @throws NullPointerException if protocol is null. * * @see java.security.Provider */ public static SSLContext getInstance(String protocol, Provider provider) throws NoSuchAlgorithmException { GetInstance.Instance instance = GetInstance.getInstance ("SSLContext", SSLContextSpi.class, protocol, provider); return new SSLContext((SSLContextSpi)instance.impl, instance.provider, protocol); } --- 233,257 ---- * Documentation</a> * for information about standard protocol names. * * @param provider an instance of the provider. * ! * @return the new {@code SSLContext} object ! * ! * @throws IllegalArgumentException if the provider is {@code null} * ! * @throws NoSuchAlgorithmException if a {@code SSLContextSpi} * implementation for the specified protocol is not available ! * from the specified {@code Provider} object * ! * @throws NullPointerException if {@code protocol} is {@code null} * * @see java.security.Provider */ public static SSLContext getInstance(String protocol, Provider provider) throws NoSuchAlgorithmException { + Objects.requireNonNull(protocol, "null protocol name"); GetInstance.Instance instance = GetInstance.getInstance ("SSLContext", SSLContextSpi.class, protocol, provider); return new SSLContext((SSLContextSpi)instance.impl, instance.provider, protocol); }
< prev index next >