< prev index next >

src/java.base/share/classes/com/sun/net/ssl/SSLContext.java

Print this page
rev 52979 : 8215281: Use String.isEmpty() when applicable in java.base
Reviewed-by: TBD


  92         }
  93     }
  94 
  95     /**
  96      * Generates a <code>SSLContext</code> object that implements the
  97      * specified secure socket protocol.
  98      *
  99      * @param protocol the standard name of the requested protocol.
 100      * @param provider the name of the provider
 101      *
 102      * @return the new <code>SSLContext</code> object
 103      *
 104      * @exception NoSuchAlgorithmException if the specified protocol is not
 105      * available from the specified provider.
 106      * @exception NoSuchProviderException if the specified provider has not
 107      * been configured.
 108      */
 109     public static SSLContext getInstance(String protocol, String provider)
 110         throws NoSuchAlgorithmException, NoSuchProviderException
 111     {
 112         if (provider == null || provider.length() == 0)
 113             throw new IllegalArgumentException("missing provider");
 114         Object[] objs = SSLSecurity.getImpl(protocol, "SSLContext",
 115                                             provider);
 116         return new SSLContext((SSLContextSpi)objs[0], (Provider)objs[1],
 117             protocol);
 118     }
 119 
 120     /**
 121      * Generates a <code>SSLContext</code> object that implements the
 122      * specified secure socket protocol.
 123      *
 124      * @param protocol the standard name of the requested protocol.
 125      * @param provider an instance of the provider
 126      *
 127      * @return the new <code>SSLContext</code> object
 128      *
 129      * @exception NoSuchAlgorithmException if the specified protocol is not
 130      * available from the specified provider.
 131      */
 132     public static SSLContext getInstance(String protocol, Provider provider)




  92         }
  93     }
  94 
  95     /**
  96      * Generates a <code>SSLContext</code> object that implements the
  97      * specified secure socket protocol.
  98      *
  99      * @param protocol the standard name of the requested protocol.
 100      * @param provider the name of the provider
 101      *
 102      * @return the new <code>SSLContext</code> object
 103      *
 104      * @exception NoSuchAlgorithmException if the specified protocol is not
 105      * available from the specified provider.
 106      * @exception NoSuchProviderException if the specified provider has not
 107      * been configured.
 108      */
 109     public static SSLContext getInstance(String protocol, String provider)
 110         throws NoSuchAlgorithmException, NoSuchProviderException
 111     {
 112         if (provider == null || provider.isEmpty())
 113             throw new IllegalArgumentException("missing provider");
 114         Object[] objs = SSLSecurity.getImpl(protocol, "SSLContext",
 115                                             provider);
 116         return new SSLContext((SSLContextSpi)objs[0], (Provider)objs[1],
 117             protocol);
 118     }
 119 
 120     /**
 121      * Generates a <code>SSLContext</code> object that implements the
 122      * specified secure socket protocol.
 123      *
 124      * @param protocol the standard name of the requested protocol.
 125      * @param provider an instance of the provider
 126      *
 127      * @return the new <code>SSLContext</code> object
 128      *
 129      * @exception NoSuchAlgorithmException if the specified protocol is not
 130      * available from the specified provider.
 131      */
 132     public static SSLContext getInstance(String protocol, Provider provider)


< prev index next >