< prev index next >

src/java.base/share/classes/javax/security/auth/login/Configuration.java

Print this page
rev 51919 : 8215281: Use String.isEmpty() when applicable in java.base
Reviewed-by: dfuchs, alanb


 401      *         registered in the security provider list
 402      *
 403      * @throws NoSuchAlgorithmException if the specified provider does not
 404      *         support a {@code ConfigurationSpi} implementation for the
 405      *         specified type
 406      *
 407      * @throws NullPointerException if {@code type} is {@code null}
 408      *
 409      * @throws SecurityException if the caller does not have permission
 410      *         to get a {@code Configuration} instance for the specified type
 411      *
 412      * @see Provider
 413      * @since 1.6
 414      */
 415     public static Configuration getInstance(String type,
 416                                 Configuration.Parameters params,
 417                                 String provider)
 418                 throws NoSuchProviderException, NoSuchAlgorithmException {
 419 
 420         Objects.requireNonNull(type, "null type name");
 421         if (provider == null || provider.length() == 0) {
 422             throw new IllegalArgumentException("missing provider");
 423         }
 424 
 425         checkPermission(type);
 426         try {
 427             GetInstance.Instance instance = GetInstance.getInstance
 428                                                         ("Configuration",
 429                                                         ConfigurationSpi.class,
 430                                                         type,
 431                                                         params,
 432                                                         provider);
 433             return new ConfigDelegate((ConfigurationSpi)instance.impl,
 434                                                         instance.provider,
 435                                                         type,
 436                                                         params);
 437         } catch (NoSuchAlgorithmException nsae) {
 438             return handleException (nsae);
 439         }
 440     }
 441 




 401      *         registered in the security provider list
 402      *
 403      * @throws NoSuchAlgorithmException if the specified provider does not
 404      *         support a {@code ConfigurationSpi} implementation for the
 405      *         specified type
 406      *
 407      * @throws NullPointerException if {@code type} is {@code null}
 408      *
 409      * @throws SecurityException if the caller does not have permission
 410      *         to get a {@code Configuration} instance for the specified type
 411      *
 412      * @see Provider
 413      * @since 1.6
 414      */
 415     public static Configuration getInstance(String type,
 416                                 Configuration.Parameters params,
 417                                 String provider)
 418                 throws NoSuchProviderException, NoSuchAlgorithmException {
 419 
 420         Objects.requireNonNull(type, "null type name");
 421         if (provider == null || provider.isEmpty()) {
 422             throw new IllegalArgumentException("missing provider");
 423         }
 424 
 425         checkPermission(type);
 426         try {
 427             GetInstance.Instance instance = GetInstance.getInstance
 428                                                         ("Configuration",
 429                                                         ConfigurationSpi.class,
 430                                                         type,
 431                                                         params,
 432                                                         provider);
 433             return new ConfigDelegate((ConfigurationSpi)instance.impl,
 434                                                         instance.provider,
 435                                                         type,
 436                                                         params);
 437         } catch (NoSuchAlgorithmException nsae) {
 438             return handleException (nsae);
 439         }
 440     }
 441 


< prev index next >