< prev index next >
src/java.base/share/classes/java/security/AlgorithmParameters.java
Print this page
rev 15967 : [mq]: GetInstance
*** 26,35 ****
--- 26,36 ----
package java.security;
import java.io.*;
import java.security.spec.AlgorithmParameterSpec;
import java.security.spec.InvalidParameterSpecException;
+ import java.util.Objects;
/**
* This class is used as an opaque representation of cryptographic parameters.
*
* <p>An {@code AlgorithmParameters} object for managing the parameters
*** 138,157 ****
* See the AlgorithmParameters section in the <a href=
* "{@docRoot}/../technotes/guides/security/StandardNames.html#AlgorithmParameters">
* Java Cryptography Architecture Standard Algorithm Name Documentation</a>
* for information about standard algorithm names.
*
! * @return the new parameter object.
*
! * @exception NoSuchAlgorithmException if no Provider supports an
! * AlgorithmParametersSpi implementation for the
! * specified algorithm.
*
* @see Provider
*/
public static AlgorithmParameters getInstance(String algorithm)
throws NoSuchAlgorithmException {
try {
Object[] objs = Security.getImpl(algorithm, "AlgorithmParameters",
(String)null);
return new AlgorithmParameters((AlgorithmParametersSpi)objs[0],
(Provider)objs[1],
--- 139,161 ----
* See the AlgorithmParameters section in the <a href=
* "{@docRoot}/../technotes/guides/security/StandardNames.html#AlgorithmParameters">
* Java Cryptography Architecture Standard Algorithm Name Documentation</a>
* for information about standard algorithm names.
*
! * @return the new parameter object
*
! * @throws NoSuchAlgorithmException if no {@code Provider} supports an
! * {@code AlgorithmParametersSpi} implementation for the
! * specified algorithm
! *
! * @throws NullPointerException if {@code algorithm} is {@code null}
*
* @see Provider
*/
public static AlgorithmParameters getInstance(String algorithm)
throws NoSuchAlgorithmException {
+ Objects.requireNonNull(algorithm, "null algorithm name");
try {
Object[] objs = Security.getImpl(algorithm, "AlgorithmParameters",
(String)null);
return new AlgorithmParameters((AlgorithmParametersSpi)objs[0],
(Provider)objs[1],
*** 182,209 ****
* Java Cryptography Architecture Standard Algorithm Name Documentation</a>
* for information about standard algorithm names.
*
* @param provider the name of the provider.
*
! * @return the new parameter object.
*
! * @exception NoSuchAlgorithmException if an AlgorithmParametersSpi
* 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 AlgorithmParameters getInstance(String algorithm,
String provider)
throws NoSuchAlgorithmException, NoSuchProviderException
{
if (provider == null || provider.length() == 0)
throw new IllegalArgumentException("missing provider");
Object[] objs = Security.getImpl(algorithm, "AlgorithmParameters",
provider);
return new AlgorithmParameters((AlgorithmParametersSpi)objs[0],
--- 186,216 ----
* Java Cryptography Architecture Standard Algorithm Name Documentation</a>
* for information about standard algorithm names.
*
* @param provider the name of the provider.
*
! * @return the new parameter object
! *
! * @throws IllegalArgumentException if the provider name is {@code null}
! * or empty
*
! * @throws NoSuchAlgorithmException if an {@code AlgorithmParametersSpi}
* 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 AlgorithmParameters 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, "AlgorithmParameters",
provider);
return new AlgorithmParameters((AlgorithmParametersSpi)objs[0],
*** 229,254 ****
* Java Cryptography Architecture Standard Algorithm Name Documentation</a>
* for information about standard algorithm names.
*
* @param provider the name of the provider.
*
! * @return the new parameter object.
*
! * @exception NoSuchAlgorithmException if an AlgorithmParameterGeneratorSpi
* implementation for the specified algorithm is not available
! * from the specified Provider object.
*
! * @exception IllegalArgumentException if the provider is null.
*
* @see Provider
*
* @since 1.4
*/
public static AlgorithmParameters getInstance(String algorithm,
Provider provider)
throws NoSuchAlgorithmException
{
if (provider == null)
throw new IllegalArgumentException("missing provider");
Object[] objs = Security.getImpl(algorithm, "AlgorithmParameters",
provider);
return new AlgorithmParameters((AlgorithmParametersSpi)objs[0],
--- 236,265 ----
* Java Cryptography Architecture Standard Algorithm Name Documentation</a>
* for information about standard algorithm names.
*
* @param provider the name of the provider.
*
! * @return the new parameter object
! *
! * @throws IllegalArgumentException if the 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 AlgorithmParameters 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, "AlgorithmParameters",
provider);
return new AlgorithmParameters((AlgorithmParametersSpi)objs[0],
< prev index next >