private static Policy getInstanceImpl(String type, Policy.Parameters paramsJ, Provider provider)//throws NoSuchAlgorithmException { { if (type == null) { throw new java.lang.NullPointerException(); } try { lock (engine) { engine.getInstance(type, provider, paramsJ); return(new PolicyDelegate((PolicySpi)engine.spi, provider, type, paramsJ)); } } catch (NoSuchAlgorithmException e) { if (e.getCause() == null) { throw e; } throw new java.lang.IllegalArgumentException("Unrecognized policy parameter: " + paramsJ.toString()); //$NON-NLS-1$ } }
/** * Answers a Policy object with the specified type and the specified * parameter. * * Traverses the list of registered security providers, beginning with the * most preferred Provider. A new Policy object encapsulating the PolicySpi * implementation from the first Provider that supports the specified type * is returned. * * Note that the list of registered providers may be retrieved via the * Security.getProviders() method. * * @param type - * the specified Policy type. See Appendix A in the Java * Cryptography Architecture API Specification & Reference for a * list of standard Policy types. * @param paramsJ - * parameters for the Policy, which may be null. * @return the new Policy object. * @throws NoSuchAlgorithmException - * if no Provider supports a PolicySpi implementation for the * specified type. * @throws SecurityException - * if the caller does not have permission to get a Policy * instance for the specified type. * @throws NullPointerException - * if the specified type is null. * @throws IllegalArgumentException - * if the specified parameters' type are not allowed by the * PolicySpi implementation from the selected Provider. * * @since 1.6 */ public static Policy getInstance(String type, Policy.Parameters paramsJ) {// throws NoSuchAlgorithmException { checkSecurityPermission(new SecurityPermission(CREATE_POLICY + type)); if (type == null) { throw new java.lang.NullPointerException(); } try { lock (engine) { engine.getInstance(type, paramsJ); return(new PolicyDelegate((PolicySpi)engine.spi, engine.provider, type, paramsJ)); } } catch (NoSuchAlgorithmException e) { if (e.getCause() == null) { throw e; } throw new java.lang.IllegalArgumentException("Unrecognized policy parameter: " + paramsJ.toString()); //$NON-NLS-1$ } }