< prev index next >

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

Print this page
rev 15967 : [mq]: GetInstance

*** 27,36 **** --- 27,37 ---- package java.security; import java.util.Enumeration; import java.util.WeakHashMap; import java.util.concurrent.atomic.AtomicReference; + import java.util.Objects; import sun.security.jca.GetInstance; import sun.security.util.Debug; import sun.security.util.SecurityConstants;
*** 370,399 **** * Java Cryptography Architecture Standard Algorithm Name Documentation</a> * for a list of standard Policy types. * * @param params parameters for the Policy, which may be null. * ! * @return the new Policy object. * ! * @exception SecurityException if the caller does not have permission ! * to get a Policy instance for the specified type. * ! * @exception NullPointerException if the specified type is null. * ! * @exception IllegalArgumentException if the specified parameters ! * are not understood by the PolicySpi implementation ! * from the selected Provider. * ! * @exception NoSuchAlgorithmException if no Provider supports a PolicySpi ! * implementation for the specified type. * * @see Provider * @since 1.6 */ public static Policy getInstance(String type, Policy.Parameters params) throws NoSuchAlgorithmException { ! checkPermission(type); try { GetInstance.Instance instance = GetInstance.getInstance("Policy", PolicySpi.class, type, --- 371,400 ---- * Java Cryptography Architecture Standard Algorithm Name Documentation</a> * for a list of standard Policy types. * * @param params parameters for the Policy, which may be null. * ! * @return the new {@code Policy} object * ! * @throws IllegalArgumentException if the specified parameters ! * are not understood by the {@code PolicySpi} implementation ! * from the selected {@code Provider} * ! * @throws NoSuchAlgorithmException if no {@code Provider} supports ! * a {@code PolicySpi} implementation for the specified type * ! * @throws NullPointerException if {@code type} is {@code null} * ! * @throws SecurityException if the caller does not have permission ! * to get a {@code Policy} instance for the specified type. * * @see Provider * @since 1.6 */ public static Policy getInstance(String type, Policy.Parameters params) throws NoSuchAlgorithmException { ! Objects.requireNonNull(type, "null type name"); checkPermission(type); try { GetInstance.Instance instance = GetInstance.getInstance("Policy", PolicySpi.class, type,
*** 426,461 **** * * @param params parameters for the Policy, which may be null. * * @param provider the provider. * ! * @return the new Policy object. * ! * @exception SecurityException if the caller does not have permission ! * to get a Policy instance for the specified type. * ! * @exception NullPointerException if the specified type is null. * ! * @exception IllegalArgumentException if the specified provider ! * is null or empty, ! * or if the specified parameters are not understood by ! * the PolicySpi implementation from the specified provider. * ! * @exception NoSuchProviderException if the specified provider is not ! * registered in the security provider list. * ! * @exception NoSuchAlgorithmException if the specified provider does not ! * support a PolicySpi implementation for the specified type. * * @see Provider * @since 1.6 */ public static Policy getInstance(String type, Policy.Parameters params, String provider) throws NoSuchProviderException, NoSuchAlgorithmException { if (provider == null || provider.length() == 0) { throw new IllegalArgumentException("missing provider"); } checkPermission(type); --- 427,464 ---- * * @param params parameters for the Policy, which may be null. * * @param provider the provider. * ! * @return the new {@code Policy} object * ! * @throws IllegalArgumentException if the specified provider ! * is {@code null} or empty, or if the specified parameters are ! * not understood by the {@code PolicySpi} implementation from ! * the specified provider * ! * @throws NoSuchAlgorithmException if the specified provider does not ! * support a {@code PolicySpi} implementation for the specified ! * type * ! * @throws NoSuchProviderException if the specified provider is not ! * registered in the security provider list * ! * @throws NullPointerException if {@code type} is {@code null} * ! * @throws SecurityException if the caller does not have permission ! * to get a {@code Policy} instance for the specified type * * @see Provider * @since 1.6 */ public static Policy getInstance(String type, Policy.Parameters params, String provider) throws NoSuchProviderException, NoSuchAlgorithmException { + Objects.requireNonNull(type, "null type name"); if (provider == null || provider.length() == 0) { throw new IllegalArgumentException("missing provider"); } checkPermission(type);
*** 490,521 **** * * @param params parameters for the Policy, which may be null. * * @param provider the Provider. * ! * @return the new Policy object. * ! * @exception SecurityException if the caller does not have permission ! * to get a Policy instance for the specified type. * ! * @exception NullPointerException if the specified type is null. * ! * @exception IllegalArgumentException if the specified Provider is null, ! * or if the specified parameters are not understood by ! * the PolicySpi implementation from the specified Provider. * ! * @exception NoSuchAlgorithmException if the specified Provider does not ! * support a PolicySpi implementation for the specified type. * * @see Provider * @since 1.6 */ public static Policy getInstance(String type, Policy.Parameters params, Provider provider) throws NoSuchAlgorithmException { if (provider == null) { throw new IllegalArgumentException("missing provider"); } checkPermission(type); --- 493,527 ---- * * @param params parameters for the Policy, which may be null. * * @param provider the Provider. * ! * @return the new {@code Policy} object * ! * @throws IllegalArgumentException if the specified {@code Provider} ! * is {@code null}, or if the specified parameters are not ! * understood by the {@code PolicySpi} implementation from the ! * specified {@code Provider} * ! * @throws NoSuchAlgorithmException if the specified {@code Provider} ! * does not support a {@code PolicySpi} implementation for ! * the specified type * ! * @throws NullPointerException if {@code type} is {@code null} * ! * @throws SecurityException if the caller does not have permission ! * to get a {@code Policy} instance for the specified type * * @see Provider * @since 1.6 */ public static Policy getInstance(String type, Policy.Parameters params, Provider provider) throws NoSuchAlgorithmException { + Objects.requireNonNull(type, "null type name"); if (provider == null) { throw new IllegalArgumentException("missing provider"); } checkPermission(type);
< prev index next >