< prev index next >

src/java.base/share/classes/java/security/AlgorithmParameters.java

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


 192      *
 193      * @throws IllegalArgumentException if the provider name is {@code null}
 194      *         or empty
 195      *
 196      * @throws NoSuchAlgorithmException if an {@code AlgorithmParametersSpi}
 197      *         implementation for the specified algorithm is not
 198      *         available from the specified provider
 199      *
 200      * @throws NoSuchProviderException if the specified provider is not
 201      *         registered in the security provider list
 202      *
 203      * @throws NullPointerException if {@code algorithm} is {@code null}
 204      *
 205      * @see Provider
 206      */
 207     public static AlgorithmParameters getInstance(String algorithm,
 208                                                   String provider)
 209         throws NoSuchAlgorithmException, NoSuchProviderException
 210     {
 211         Objects.requireNonNull(algorithm, "null algorithm name");
 212         if (provider == null || provider.length() == 0)
 213             throw new IllegalArgumentException("missing provider");
 214         Object[] objs = Security.getImpl(algorithm, "AlgorithmParameters",
 215                                          provider);
 216         return new AlgorithmParameters((AlgorithmParametersSpi)objs[0],
 217                                        (Provider)objs[1],
 218                                        algorithm);
 219     }
 220 
 221     /**
 222      * Returns a parameter object for the specified algorithm.
 223      *
 224      * <p> A new AlgorithmParameters object encapsulating the
 225      * AlgorithmParametersSpi implementation from the specified Provider
 226      * object is returned.  Note that the specified Provider object
 227      * does not have to be registered in the provider list.
 228      *
 229      * <p>The returned parameter object must be initialized via a call to
 230      * {@code init}, using an appropriate parameter specification or
 231      * parameter encoding.
 232      *




 192      *
 193      * @throws IllegalArgumentException if the provider name is {@code null}
 194      *         or empty
 195      *
 196      * @throws NoSuchAlgorithmException if an {@code AlgorithmParametersSpi}
 197      *         implementation for the specified algorithm is not
 198      *         available from the specified provider
 199      *
 200      * @throws NoSuchProviderException if the specified provider is not
 201      *         registered in the security provider list
 202      *
 203      * @throws NullPointerException if {@code algorithm} is {@code null}
 204      *
 205      * @see Provider
 206      */
 207     public static AlgorithmParameters getInstance(String algorithm,
 208                                                   String provider)
 209         throws NoSuchAlgorithmException, NoSuchProviderException
 210     {
 211         Objects.requireNonNull(algorithm, "null algorithm name");
 212         if (provider == null || provider.isEmpty())
 213             throw new IllegalArgumentException("missing provider");
 214         Object[] objs = Security.getImpl(algorithm, "AlgorithmParameters",
 215                                          provider);
 216         return new AlgorithmParameters((AlgorithmParametersSpi)objs[0],
 217                                        (Provider)objs[1],
 218                                        algorithm);
 219     }
 220 
 221     /**
 222      * Returns a parameter object for the specified algorithm.
 223      *
 224      * <p> A new AlgorithmParameters object encapsulating the
 225      * AlgorithmParametersSpi implementation from the specified Provider
 226      * object is returned.  Note that the specified Provider object
 227      * does not have to be registered in the provider list.
 228      *
 229      * <p>The returned parameter object must be initialized via a call to
 230      * {@code init}, using an appropriate parameter specification or
 231      * parameter encoding.
 232      *


< prev index next >