Program: 29209
Project: 29209
Buggy source:
/** 
 * This static method uses a system property to find and instantiate (via a public constructor) a provider specific factory implementation class. The name of the provider specific factory implementation class is obtained from the value of the system property, <P><code><Pre> javax.security.jacc.PolicyConfigurationFactory.provider. </Pre></code><P>
 * @return the singleton instance of the provider specificPolicyConfigurationFactory implementation class.
 * @throws java.lang.SecurityException when called by an AccessControlContext that has not been granted the "setPolicy" SecurityPermission.
 * @throws java.lang.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 javax.security.jacc.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 java.lang.ClassNotFoundException, javax.security.jacc.PolicyContextException {
  SecurityManager sm=System.getSecurityManager();
  if (sm != null)   sm.checkPermission(new java.security.SecurityPermission("String_Node_Str"));
  if (pcFactory != null)   return pcFactory;
  String msg;
  final String classname[]={null};
  try {
    Class clazz=null;
    if (sm != null) {
      try {
        clazz=(Class)AccessController.doPrivileged(new PrivilegedExceptionAction(){
          public Object run() throws java.lang.Exception {
            classname[0]=System.getProperty(FACTORY_NAME);
            if (classname[0] == null) {
              String msg="String_Node_Str" + FACTORY_NAME;
              throw new ClassNotFoundException(msg);
            }
            return Class.forName(classname[0],true,Thread.currentThread().getContextClassLoader());
          }
        }
);
      }
 catch (      PrivilegedActionException ex) {
        Exception e=ex.getException();
        if (e instanceof java.lang.ClassNotFoundException) {
          throw (java.lang.ClassNotFoundException)e;
        }
 else         if (e instanceof java.lang.InstantiationException) {
          throw (java.lang.InstantiationException)e;
        }
 else         if (e instanceof java.lang.IllegalAccessException) {
          throw (java.lang.IllegalAccessException)e;
        }
      }
    }
 else {
      classname[0]=System.getProperty(FACTORY_NAME);
      if (classname[0] == null) {
        msg="String_Node_Str" + FACTORY_NAME;
        throw new ClassNotFoundException(msg);
      }
      clazz=Class.forName(classname[0],true,Thread.currentThread().getContextClassLoader());
    }
    Object factory=clazz.newInstance();
    pcFactory=(PolicyConfigurationFactory)factory;
  }
 catch (  java.lang.ClassNotFoundException cnfe) {
    msg="String_Node_Str" + classname[0];
    throw new ClassNotFoundException(msg,cnfe);
  }
catch (  java.lang.IllegalAccessException iae) {
    msg="String_Node_Str" + classname[0];
    throw new PolicyContextException(msg,iae);
  }
catch (  java.lang.InstantiationException ie) {
    msg="String_Node_Str" + classname[0];
    throw new PolicyContextException(msg,ie);
  }
catch (  java.lang.ClassCastException cce) {
    msg="String_Node_Str" + classname[0];
    throw new ClassCastException(msg);
  }
  return pcFactory;
}

Fixed version (ground truth):
/** 
 * This static method uses a system property to find and instantiate (via a public constructor) a provider specific factory implementation class. The name of the provider specific factory implementation class is obtained from the value of the system property, <P><code><Pre> javax.security.jacc.PolicyConfigurationFactory.provider. </Pre></code><P>
 * @return the singleton instance of the provider specificPolicyConfigurationFactory implementation class.
 * @throws java.lang.SecurityException when called by an AccessControlContext that has not been granted the "setPolicy" SecurityPermission.
 * @throws java.lang.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 javax.security.jacc.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 java.lang.ClassNotFoundException, javax.security.jacc.PolicyContextException {
  SecurityManager sm=System.getSecurityManager();
  if (sm != null)   sm.checkPermission(new java.security.SecurityPermission("String_Node_Str"));
  if (pcFactory != null)   return pcFactory;
  String msg;
  final String classname[]={null};
  try {
    Class clazz=null;
    if (sm != null) {
      try {
        clazz=(Class)AccessController.doPrivileged(new PrivilegedExceptionAction(){
          public Object run() throws java.lang.Exception {
            classname[0]=System.getProperty(FACTORY_NAME);
            if (classname[0] == null) {
              String msg="String_Node_Str" + FACTORY_NAME;
              throw new ClassNotFoundException(msg);
            }
            return Class.forName(classname[0],true,Thread.currentThread().getContextClassLoader());
          }
        }
);
      }
 catch (      PrivilegedActionException ex) {
        Exception e=ex.getException();
        if (e instanceof java.lang.ClassNotFoundException) {
          throw (java.lang.ClassNotFoundException)e;
        }
 else         if (e instanceof java.lang.InstantiationException) {
          throw (java.lang.InstantiationException)e;
        }
 else         if (e instanceof java.lang.IllegalAccessException) {
          throw (java.lang.IllegalAccessException)e;
        }
      }
    }
 else {
      classname[0]=System.getProperty(FACTORY_NAME);
      if (classname[0] == null) {
        msg="String_Node_Str" + FACTORY_NAME;
        throw new ClassNotFoundException(msg);
      }
      clazz=Class.forName(classname[0],true,Thread.currentThread().getContextClassLoader());
    }
    if (clazz != null) {
      Object factory=clazz.newInstance();
      pcFactory=(PolicyConfigurationFactory)factory;
    }
  }
 catch (  java.lang.ClassNotFoundException cnfe) {
    msg="String_Node_Str" + classname[0];
    throw new ClassNotFoundException(msg,cnfe);
  }
catch (  java.lang.IllegalAccessException iae) {
    msg="String_Node_Str" + classname[0];
    throw new PolicyContextException(msg,iae);
  }
catch (  java.lang.InstantiationException ie) {
    msg="String_Node_Str" + classname[0];
    throw new PolicyContextException(msg,ie);
  }
catch (  java.lang.ClassCastException cce) {
    msg="String_Node_Str" + classname[0];
    throw new ClassCastException(msg);
  }
  return pcFactory;
}