< prev index next >
src/java.base/share/classes/java/security/cert/CertStore.java
Print this page
rev 15967 : [mq]: GetInstance
*** 31,40 ****
--- 31,41 ----
import java.security.NoSuchProviderException;
import java.security.PrivilegedAction;
import java.security.Provider;
import java.security.Security;
import java.util.Collection;
+ import java.util.Objects;
import sun.security.jca.*;
import sun.security.jca.GetInstance.Instance;
/**
*** 216,239 ****
* for information about standard types.
*
* @param params the initialization parameters (may be {@code null}).
*
* @return a {@code CertStore} object that implements the specified
! * {@code CertStore} type.
! *
! * @throws NoSuchAlgorithmException if no Provider supports a
! * CertStoreSpi implementation for the specified type.
*
* @throws InvalidAlgorithmParameterException if the specified
* initialization parameters are inappropriate for this
! * {@code CertStore}.
*
* @see java.security.Provider
*/
public static CertStore getInstance(String type, CertStoreParameters params)
throws InvalidAlgorithmParameterException,
NoSuchAlgorithmException {
try {
Instance instance = GetInstance.getInstance("CertStore",
CertStoreSpi.class, type, params);
return new CertStore((CertStoreSpi)instance.impl,
instance.provider, type, params);
--- 217,243 ----
* for information about standard types.
*
* @param params the initialization parameters (may be {@code null}).
*
* @return a {@code CertStore} object that implements the specified
! * {@code CertStore} type
*
* @throws InvalidAlgorithmParameterException if the specified
* initialization parameters are inappropriate for this
! * {@code CertStore}
! *
! * @throws NoSuchAlgorithmException if no {@code Provider} supports a
! * {@code CertStoreSpi} implementation for the specified type
! *
! * @throws NullPointerException if {@code type} is {@code null}
*
* @see java.security.Provider
*/
public static CertStore getInstance(String type, CertStoreParameters params)
throws InvalidAlgorithmParameterException,
NoSuchAlgorithmException {
+ Objects.requireNonNull(type, "null type name");
try {
Instance instance = GetInstance.getInstance("CertStore",
CertStoreSpi.class, type, params);
return new CertStore((CertStoreSpi)instance.impl,
instance.provider, type, params);
*** 241,251 ****
return handleException(e);
}
}
private static CertStore handleException(NoSuchAlgorithmException e)
! throws NoSuchAlgorithmException, InvalidAlgorithmParameterException {
Throwable cause = e.getCause();
if (cause instanceof InvalidAlgorithmParameterException) {
throw (InvalidAlgorithmParameterException)cause;
}
throw e;
--- 245,256 ----
return handleException(e);
}
}
private static CertStore handleException(NoSuchAlgorithmException e)
! throws NoSuchAlgorithmException,
! InvalidAlgorithmParameterException {
Throwable cause = e.getCause();
if (cause instanceof InvalidAlgorithmParameterException) {
throw (InvalidAlgorithmParameterException)cause;
}
throw e;
*** 278,309 ****
* @param params the initialization parameters (may be {@code null}).
*
* @param provider the name of the provider.
*
* @return a {@code CertStore} object that implements the
! * specified type.
*
! * @throws NoSuchAlgorithmException if a CertStoreSpi
! * implementation for the specified type is not
! * available from the specified provider.
*
* @throws InvalidAlgorithmParameterException if the specified
* initialization parameters are inappropriate for this
! * {@code CertStore}.
*
* @throws NoSuchProviderException if the specified provider is not
! * registered in the security provider list.
*
! * @exception IllegalArgumentException if the {@code provider} is
! * null or empty.
*
* @see java.security.Provider
*/
public static CertStore getInstance(String type,
CertStoreParameters params, String provider)
throws InvalidAlgorithmParameterException,
NoSuchAlgorithmException, NoSuchProviderException {
try {
Instance instance = GetInstance.getInstance("CertStore",
CertStoreSpi.class, type, params, provider);
return new CertStore((CertStoreSpi)instance.impl,
instance.provider, type, params);
--- 283,317 ----
* @param params the initialization parameters (may be {@code null}).
*
* @param provider the name of the provider.
*
* @return a {@code CertStore} object that implements the
! * specified type
*
! * @throws IllegalArgumentException if the {@code provider} is
! * {@code null} or empty
*
* @throws InvalidAlgorithmParameterException if the specified
* initialization parameters are inappropriate for this
! * {@code CertStore}
! *
! * @throws NoSuchAlgorithmException if a {@code CertStoreSpi}
! * implementation for the specified type 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 type} is {@code null}
*
* @see java.security.Provider
*/
public static CertStore getInstance(String type,
CertStoreParameters params, String provider)
throws InvalidAlgorithmParameterException,
NoSuchAlgorithmException, NoSuchProviderException {
+ Objects.requireNonNull(type, "null type name");
try {
Instance instance = GetInstance.getInstance("CertStore",
CertStoreSpi.class, type, params, provider);
return new CertStore((CertStoreSpi)instance.impl,
instance.provider, type, params);
*** 336,363 ****
* @param params the initialization parameters (may be {@code null}).
*
* @param provider the provider.
*
* @return a {@code CertStore} object that implements the
! * specified type.
*
! * @exception NoSuchAlgorithmException if a CertStoreSpi
! * implementation for the specified type is not available
! * from the specified Provider object.
*
* @throws InvalidAlgorithmParameterException if the specified
* initialization parameters are inappropriate for this
* {@code CertStore}
*
! * @exception IllegalArgumentException if the {@code provider} is
! * null.
*
* @see java.security.Provider
*/
public static CertStore getInstance(String type, CertStoreParameters params,
Provider provider) throws NoSuchAlgorithmException,
InvalidAlgorithmParameterException {
try {
Instance instance = GetInstance.getInstance("CertStore",
CertStoreSpi.class, type, params, provider);
return new CertStore((CertStoreSpi)instance.impl,
instance.provider, type, params);
--- 344,374 ----
* @param params the initialization parameters (may be {@code null}).
*
* @param provider the provider.
*
* @return a {@code CertStore} object that implements the
! * specified type
*
! * @throws IllegalArgumentException if the {@code provider} is
! * null
*
* @throws InvalidAlgorithmParameterException if the specified
* initialization parameters are inappropriate for this
* {@code CertStore}
*
! * @throws NoSuchAlgorithmException if a {@code CertStoreSpi}
! * implementation for the specified type is not available
! * from the specified Provider object
! *
! * @throws NullPointerException if {@code type} is {@code null}
*
* @see java.security.Provider
*/
public static CertStore getInstance(String type, CertStoreParameters params,
Provider provider) throws NoSuchAlgorithmException,
InvalidAlgorithmParameterException {
+ Objects.requireNonNull(type, "null type name");
try {
Instance instance = GetInstance.getInstance("CertStore",
CertStoreSpi.class, type, params, provider);
return new CertStore((CertStoreSpi)instance.impl,
instance.provider, type, params);
< prev index next >