Program: 25048
Project: 25048
Buggy source:
/** 
 * <p>Create an instance of the specified class. The class name is expected to be surrounded by {} in the given value.</p> <p><b>IMPORTANT:</b> The instance is created using the constructor whose the declaration matches exactly with the given list of parameter types. The number and types of given parameters MUST match exactly to the list of parameter types. </p>
 * @param propValue		Value which is supposed to contain the class name between brackets (see {@link #isClassName(String)} for more details)
 * @param propName		Name of the property associated with the parameter "value".
 * @param expectedType	Type of the class expected to be returned ; it is also the type which parameterizes this function: C.
 * @param pTypes		List of each constructor parameter type. Each type MUST be exactly the type declared in the class constructor to select. <i>NULL or empty array if no parameter.</i>
 * @param parameters	List of all constructor parameters. The number of object MUST match exactly the number of classes provided in the parameter pTypes. <i>NULL or empty array if no parameter.</i>
 * @return	The corresponding instance.
 * @throws TAPException	If the class name is incorrector if its type is not compatible with the parameterized type C (represented by the parameter "expectedType") or if the constructor with the specified parameters can not be found or if an error occurred while calling this constructor.
 * @see #isClassName(String)
 * @see #fetchClass(String,String,Class)
 */
public final static <C>C newInstance(final String propValue,final String propName,final Class<C> expectedType,final Class<?>[] pTypes,final Object[] parameters) throws TAPException {
  if (!isClassName(propValue))   throw new TAPException("String_Node_Str" + propName + "String_Node_Str"+ propValue+ "String_Node_Str"+ expectedType.getName()+ "String_Node_Str");
  Class<? extends C> classObj=null;
  try {
    classObj=fetchClass(propValue,propName,expectedType);
    Constructor<? extends C> constructor=classObj.getConstructor((pTypes == null) ? new Class<?>[0] : pTypes);
    return constructor.newInstance((parameters == null) ? new Object[0] : parameters);
  }
 catch (  NoSuchMethodException e) {
    StringBuffer pTypesStr=new StringBuffer();
    for (int i=0; i < pTypes.length; i++) {
      if (pTypesStr.length() > 0)       pTypesStr.append("String_Node_Str");
      if (pTypes[i] == null)       pTypesStr.append("String_Node_Str");
      pTypesStr.append(pTypes[i].getName());
    }
    throw new TAPException("String_Node_Str" + classObj.getName() + "String_Node_Str"+ pTypesStr.toString()+ "String_Node_Str"+ propValue+ "String_Node_Str"+ propName+ "String_Node_Str");
  }
catch (  InstantiationException ie) {
    throw new TAPException("String_Node_Str" + classObj.getName() + "String_Node_Str"+ propValue+ "String_Node_Str"+ propName+ "String_Node_Str");
  }
catch (  InvocationTargetException ite) {
    if (ite.getCause() != null) {
      if (ite.getCause() instanceof TAPException)       throw (TAPException)ite.getCause();
 else       throw new TAPException(ite.getCause());
    }
 else     throw new TAPException(ite);
  }
catch (  TAPException te) {
    throw te;
  }
catch (  Exception ex) {
    throw new TAPException("String_Node_Str" + expectedType.getName() + "String_Node_Str"+ propName+ "String_Node_Str"+ propValue+ "String_Node_Str",ex);
  }
}

Fixed version (ground truth):
/** 
 * <p>Create an instance of the specified class. The class name is expected to be surrounded by {} in the given value.</p> <p><b>IMPORTANT:</b> The instance is created using the constructor whose the declaration matches exactly with the given list of parameter types. The number and types of given parameters MUST match exactly to the list of parameter types. </p>
 * @param propValue		Value which is supposed to contain the class name between brackets (see {@link #isClassName(String)} for more details)
 * @param propName		Name of the property associated with the parameter "value".
 * @param expectedType	Type of the class expected to be returned ; it is also the type which parameterizes this function: C.
 * @param pTypes		List of each constructor parameter type. Each type MUST be exactly the type declared in the class constructor to select. <i>NULL or empty array if no parameter.</i>
 * @param parameters	List of all constructor parameters. The number of object MUST match exactly the number of classes provided in the parameter pTypes. <i>NULL or empty array if no parameter.</i>
 * @return	The corresponding instance.
 * @throws TAPException	If the class name is incorrector if its type is not compatible with the parameterized type C (represented by the parameter "expectedType") or if the constructor with the specified parameters can not be found or if an error occurred while calling this constructor.
 * @see #isClassName(String)
 * @see #fetchClass(String,String,Class)
 */
public final static <C>C newInstance(final String propValue,final String propName,final Class<C> expectedType,final Class<?>[] pTypes,final Object[] parameters) throws TAPException {
  if (!isClassName(propValue))   throw new TAPException("String_Node_Str" + propName + "String_Node_Str"+ propValue+ "String_Node_Str"+ expectedType.getName()+ "String_Node_Str");
  Class<? extends C> classObj=null;
  try {
    classObj=fetchClass(propValue,propName,expectedType);
    Constructor<? extends C> constructor=classObj.getConstructor((pTypes == null) ? new Class<?>[0] : pTypes);
    return constructor.newInstance((parameters == null) ? new Object[0] : parameters);
  }
 catch (  NoSuchMethodException e) {
    StringBuffer pTypesStr=new StringBuffer();
    if (pTypes != null) {
      for (int i=0; i < pTypes.length; i++) {
        if (pTypesStr.length() > 0)         pTypesStr.append("String_Node_Str");
        if (pTypes[i] == null)         pTypesStr.append("String_Node_Str");
        pTypesStr.append(pTypes[i].getName());
      }
    }
    throw new TAPException("String_Node_Str" + classObj.getName() + "String_Node_Str"+ pTypesStr.toString()+ "String_Node_Str"+ propValue+ "String_Node_Str"+ propName+ "String_Node_Str");
  }
catch (  InstantiationException ie) {
    throw new TAPException("String_Node_Str" + classObj.getName() + "String_Node_Str"+ propValue+ "String_Node_Str"+ propName+ "String_Node_Str");
  }
catch (  InvocationTargetException ite) {
    if (ite.getCause() != null) {
      if (ite.getCause() instanceof TAPException)       throw (TAPException)ite.getCause();
 else       throw new TAPException(ite.getCause());
    }
 else     throw new TAPException(ite);
  }
catch (  TAPException te) {
    throw te;
  }
catch (  Exception ex) {
    throw new TAPException("String_Node_Str" + expectedType.getName() + "String_Node_Str"+ propName+ "String_Node_Str"+ propValue+ "String_Node_Str",ex);
  }
}