/** * This static method uses a system property to find and instantiate (via a public constructor) a * provider spe- cific factory implementation class. The name of the provider specific factory * implementation class is obtained from the value of the system property, * * <pre> * javax.security.jacc.PolicyConfigurationFactory.provider. * </pre> * * @return the singleton instance of the provider specific PolicyConfigurationFactory * implementation class. * @throws SecurityException - when called by an AccessControlContext that has not been granted * the “setPolicy” SecurityPermission. * @throws ClassNotFoundException - when the class named by the system property could not be found * including because the value of the system property has not be set. * @throws PolicyContextException - if the implementation throws a checked exception that has not * been accounted for by the getPolicyConfigurationFactory method signature. The exception * thrown by the implementation class will be encapsulated (during construction) in the thrown * PolicyContextException */ public static PolicyConfigurationFactory getPolicyConfigurationFactory() throws ClassNotFoundException, PolicyContextException { // Validate the caller permission SecurityManager sm = System.getSecurityManager(); if (sm != null) sm.checkPermission(new SecurityPermission("setPolicy")); synchronized (PolicyConfigurationFactory.class) { if (factory == null) { String factoryName = null; Class<?> clazz = null; try { LoadAction action = new LoadAction(); try { clazz = AccessController.doPrivileged(action); factoryName = action.getName(); } catch (PrivilegedActionException ex) { factoryName = action.getName(); Exception e = ex.getException(); if (e instanceof ClassNotFoundException) throw (ClassNotFoundException) e; else throw new PolicyContextException("Failure during load of class: " + factoryName, e); } factory = (PolicyConfigurationFactory) clazz.newInstance(); } catch (ClassNotFoundException e) { String msg = "Failed to find PolicyConfigurationFactory : " + factoryName; throw new ClassNotFoundException(msg, e); } catch (IllegalAccessException e) { String msg = "Unable to access class : " + factoryName; throw new PolicyContextException(msg, e); } catch (InstantiationException e) { String msg = "Failed to create instance of: " + factoryName; throw new PolicyContextException(msg, e); } catch (ClassCastException e) { StringBuffer msg = new StringBuffer(factoryName + " Is not a PolicyConfigurationFactory, "); msg.append("PCF.class.CL: " + PolicyConfigurationFactory.class.getClassLoader()); msg.append( "\nPCF.class.CS: " + PolicyConfigurationFactory.class.getProtectionDomain().getCodeSource()); msg.append( "\nPCF.class.hash: " + System.identityHashCode(PolicyConfigurationFactory.class)); msg.append("\nclazz.CL: " + clazz.getClassLoader()); msg.append("\nclazz.CS: " + clazz.getProtectionDomain().getCodeSource()); msg.append("\nclazz.super.CL: " + clazz.getSuperclass().getClassLoader()); msg.append( "\nclazz.super.CS: " + clazz.getSuperclass().getProtectionDomain().getCodeSource()); msg.append("\nclazz.super.hash: " + System.identityHashCode(clazz.getSuperclass())); ClassCastException cce = new ClassCastException(msg.toString()); cce.initCause(e); throw cce; } } } return factory; }
public void continueAction() { LoadAction.openImage(fileName); }