< prev index next >

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

Print this page
rev 15967 : [mq]: GetInstance

*** 24,33 **** --- 24,34 ---- */ package java.security; import java.security.spec.AlgorithmParameterSpec; + import java.util.Objects; /** * The {@code AlgorithmParameterGenerator} class is used to generate a * set of * parameters to be used with a certain algorithm. Parameter generators
*** 151,170 **** * See the AlgorithmParameterGenerator section in the <a href= * "{@docRoot}/../technotes/guides/security/StandardNames.html#AlgorithmParameterGenerator"> * Java Cryptography Architecture Standard Algorithm Name Documentation</a> * for information about standard algorithm names. * ! * @return the new AlgorithmParameterGenerator object. * ! * @exception NoSuchAlgorithmException if no Provider supports an ! * AlgorithmParameterGeneratorSpi implementation for the ! * specified algorithm. * * @see Provider */ public static AlgorithmParameterGenerator getInstance(String algorithm) throws NoSuchAlgorithmException { try { Object[] objs = Security.getImpl(algorithm, "AlgorithmParameterGenerator", (String)null); return new AlgorithmParameterGenerator --- 152,174 ---- * See the AlgorithmParameterGenerator section in the <a href= * "{@docRoot}/../technotes/guides/security/StandardNames.html#AlgorithmParameterGenerator"> * Java Cryptography Architecture Standard Algorithm Name Documentation</a> * for information about standard algorithm names. * ! * @return the new {@code AlgorithmParameterGenerator} object * ! * @throws NoSuchAlgorithmException if no {@code Provider} supports an ! * {@code AlgorithmParameterGeneratorSpi} implementation for the ! * specified algorithm ! * ! * @throws NullPointerException if {@code algorithm} is {@code null} * * @see Provider */ public static AlgorithmParameterGenerator getInstance(String algorithm) throws NoSuchAlgorithmException { + Objects.requireNonNull(algorithm, "null algorithm name"); try { Object[] objs = Security.getImpl(algorithm, "AlgorithmParameterGenerator", (String)null); return new AlgorithmParameterGenerator
*** 195,222 **** * Java Cryptography Architecture Standard Algorithm Name Documentation</a> * for information about standard algorithm names. * * @param provider the string name of the Provider. * ! * @return the new AlgorithmParameterGenerator object. * ! * @exception NoSuchAlgorithmException if an AlgorithmParameterGeneratorSpi * implementation for the specified algorithm is not ! * available from the specified provider. * ! * @exception NoSuchProviderException if the specified provider is not ! * registered in the security provider list. * ! * @exception IllegalArgumentException if the provider name is null ! * or empty. * * @see Provider */ public static AlgorithmParameterGenerator getInstance(String algorithm, String provider) throws NoSuchAlgorithmException, NoSuchProviderException { if (provider == null || provider.length() == 0) throw new IllegalArgumentException("missing provider"); Object[] objs = Security.getImpl(algorithm, "AlgorithmParameterGenerator", provider); --- 199,230 ---- * Java Cryptography Architecture Standard Algorithm Name Documentation</a> * for information about standard algorithm names. * * @param provider the string name of the Provider. * ! * @return the new {@code AlgorithmParameterGenerator} object ! * ! * @throws IllegalArgumentException if the provider name is {@code null} ! * or empty * ! * @throws NoSuchAlgorithmException if an ! * {@code AlgorithmParameterGeneratorSpi} * implementation for the specified algorithm 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 algorithm} is {@code null} * * @see Provider */ public static AlgorithmParameterGenerator getInstance(String algorithm, String provider) throws NoSuchAlgorithmException, NoSuchProviderException { + Objects.requireNonNull(algorithm, "null algorithm name"); if (provider == null || provider.length() == 0) throw new IllegalArgumentException("missing provider"); Object[] objs = Security.getImpl(algorithm, "AlgorithmParameterGenerator", provider);
*** 239,266 **** * See the AlgorithmParameterGenerator section in the <a href= * "{@docRoot}/../technotes/guides/security/StandardNames.html#AlgorithmParameterGenerator"> * Java Cryptography Architecture Standard Algorithm Name Documentation</a> * for information about standard algorithm names. * ! * @param provider the Provider object. * ! * @return the new AlgorithmParameterGenerator object. * ! * @exception NoSuchAlgorithmException if an AlgorithmParameterGeneratorSpi * implementation for the specified algorithm is not available ! * from the specified Provider object. * ! * @exception IllegalArgumentException if the specified provider is null. * * @see Provider * * @since 1.4 */ public static AlgorithmParameterGenerator getInstance(String algorithm, Provider provider) throws NoSuchAlgorithmException { if (provider == null) throw new IllegalArgumentException("missing provider"); Object[] objs = Security.getImpl(algorithm, "AlgorithmParameterGenerator", provider); --- 247,279 ---- * See the AlgorithmParameterGenerator section in the <a href= * "{@docRoot}/../technotes/guides/security/StandardNames.html#AlgorithmParameterGenerator"> * Java Cryptography Architecture Standard Algorithm Name Documentation</a> * for information about standard algorithm names. * ! * @param provider the {@code Provider} object. ! * ! * @return the new {@code AlgorithmParameterGenerator} object * ! * @throws IllegalArgumentException if the specified provider is ! * {@code null} * ! * @throws NoSuchAlgorithmException if an ! * {@code AlgorithmParameterGeneratorSpi} * implementation for the specified algorithm is not available ! * from the specified {@code Provider} object * ! * @throws NullPointerException if {@code algorithm} is {@code null} * * @see Provider * * @since 1.4 */ public static AlgorithmParameterGenerator getInstance(String algorithm, Provider provider) throws NoSuchAlgorithmException { + Objects.requireNonNull(algorithm, "null algorithm name"); if (provider == null) throw new IllegalArgumentException("missing provider"); Object[] objs = Security.getImpl(algorithm, "AlgorithmParameterGenerator", provider);
< prev index next >