Program: 3973
Project: 3973
Buggy source:
/** 
 * Parses the.
 * @param < T > the generic type
 * @param cls the cls
 * @param value the value
 * @return the t
 * @throws InstantiationException the instantiation exception
 * @throws IllegalAccessException the illegal access exception
 * @throws java.text.ParseException the parse exception
 */
protected static <T>T parse(Class<T> cls,String value) throws InstantiationException, IllegalAccessException, ParseException {
  if (cls.isEnum()) {
    Map<String,String> stringToEnumDict;
    if (schemaToEnumDictionaries.getMember().containsKey(cls)) {
      stringToEnumDict=schemaToEnumDictionaries.getMember().get(cls);
      if (stringToEnumDict.containsKey(value)) {
        String strEnumName=stringToEnumDict.get(value);
        for (        Object o : cls.getEnumConstants()) {
          if (o.toString().equals(strEnumName)) {
            return (T)o;
          }
        }
        return null;
      }
 else {
        for (        Object o : cls.getEnumConstants()) {
          if (o.toString().equals(value)) {
            return (T)o;
          }
        }
        return null;
      }
    }
 else {
      for (      Object o : cls.getEnumConstants()) {
        if (o.toString().equals(value)) {
          return (T)o;
        }
      }
      return null;
    }
  }
 else   if (cls.isInstance(Integer.valueOf(0))) {
    Object o=null;
    o=Integer.parseInt(value);
    return (T)o;
  }
 else   if (cls.isInstance(new Date())) {
    Object o=null;
    DateFormat df=new SimpleDateFormat("String_Node_Str");
    return (T)df.parse(value);
  }
 else   if (cls.isInstance(Boolean.valueOf(false))) {
    Object o=null;
    o=Boolean.parseBoolean(value);
    return (T)o;
  }
 else   if (cls.isInstance(new String())) {
    return (T)value;
  }
 else   if (cls.isInstance(Double.valueOf(0.0))) {
    Object o=null;
    o=Double.parseDouble(value);
    return (T)o;
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Parses the.
 * @param < T > the generic type
 * @param cls the cls
 * @param value the value
 * @return the t
 * @throws InstantiationException the instantiation exception
 * @throws IllegalAccessException the illegal access exception
 * @throws java.text.ParseException the parse exception
 */
protected static <T>T parse(Class<T> cls,String value) throws InstantiationException, IllegalAccessException, ParseException {
  if (cls.isEnum()) {
    Map<String,String> stringToEnumDict;
    if (schemaToEnumDictionaries.getMember().containsKey(cls)) {
      stringToEnumDict=schemaToEnumDictionaries.getMember().get(cls);
      if (stringToEnumDict.containsKey(value)) {
        String strEnumName=stringToEnumDict.get(value);
        for (        Object o : cls.getEnumConstants()) {
          if (o.toString().equals(strEnumName)) {
            return (T)o;
          }
        }
        return null;
      }
 else {
        for (        Object o : cls.getEnumConstants()) {
          if (o.toString().equals(value)) {
            return (T)o;
          }
        }
        return null;
      }
    }
 else {
      for (      Object o : cls.getEnumConstants()) {
        if (o.toString().equals(value)) {
          return (T)o;
        }
      }
      return null;
    }
  }
 else   if (cls.isInstance(Integer.valueOf(0))) {
    Object o=null;
    o=Integer.parseInt(value);
    return (T)o;
  }
 else   if (cls.isInstance(new Date())) {
    Object o=null;
    DateFormat df=new SimpleDateFormat("String_Node_Str");
    df.setTimeZone(TimeZone.getTimeZone("String_Node_Str"));
    return (T)df.parse(value);
  }
 else   if (cls.isInstance(Boolean.valueOf(false))) {
    Object o=null;
    o=Boolean.parseBoolean(value);
    return (T)o;
  }
 else   if (cls.isInstance(new String())) {
    return (T)value;
  }
 else   if (cls.isInstance(Double.valueOf(0.0))) {
    Object o=null;
    o=Double.parseDouble(value);
    return (T)o;
  }
  return null;
}