Program: 29502
Project: 29502
Buggy source:
/** 
 * Convert the given <code>RestModel</code> encoded as JSON to a live Java Object.
 * @param modelClass The target <code>RestModel</code> type
 * @param json The json encoding of the object
 * @return
 */
public <T>T unmarshallClass(Class<T> modelClass,JSONObject json){
  try {
    T model=getModel(modelClass);
    for (    Method setter : getSetters(modelClass)) {
      String name=setter.getName();
      String attribute=name.substring(3,4).toLowerCase() + name.substring(4);
      Type param0=setter.getGenericParameterTypes()[0];
      if (json.has(attribute)) {
        java.lang.Object o=json.get(attribute);
        if (JSONArray.class.isAssignableFrom(o.getClass())) {
          JSONArray array=(JSONArray)o;
          List values=new ArrayList();
          Type type=Object.class;
          if (ParameterizedType.class.isAssignableFrom(param0.getClass())) {
            type=((ParameterizedType)param0).getActualTypeArguments()[0];
          }
          for (int i=0; i < array.length(); i++) {
            Object element=array.get(i);
            if (JSONObject.class.isAssignableFrom(element.getClass())) {
              values.add(unmarshallClass((Class)type,(JSONObject)element));
            }
 else {
              values.add(element);
            }
          }
          setter.invoke(model,values);
        }
 else         if (JSONObject.class.isAssignableFrom(o.getClass())) {
          setter.invoke(model,unmarshallClass(param0.getClass(),(JSONObject)o));
        }
 else {
          setter.invoke(model,o);
        }
      }
    }
    return model;
  }
 catch (  Exception e) {
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
/** 
 * Convert the given <code>RestModel</code> encoded as JSON to a live Java Object.
 * @param modelClass The target <code>RestModel</code> type
 * @param json The json encoding of the object
 * @return
 */
public <T>T unmarshallClass(Class<T> modelClass,JSONObject json){
  try {
    T model=getModel(modelClass);
    for (    Method setter : getSetters(modelClass)) {
      String name=setter.getName();
      String attribute=name.substring(3,4).toLowerCase(Locale.getDefault()) + name.substring(4);
      Type param0=setter.getGenericParameterTypes()[0];
      if (json.has(attribute)) {
        java.lang.Object o=json.get(attribute);
        if (JSONArray.class.isAssignableFrom(o.getClass())) {
          JSONArray array=(JSONArray)o;
          List values=new ArrayList();
          Type type=Object.class;
          if (ParameterizedType.class.isAssignableFrom(param0.getClass())) {
            type=((ParameterizedType)param0).getActualTypeArguments()[0];
          }
          for (int i=0; i < array.length(); i++) {
            Object element=array.get(i);
            if (JSONObject.class.isAssignableFrom(element.getClass())) {
              values.add(unmarshallClass((Class)type,(JSONObject)element));
            }
 else {
              values.add(element);
            }
          }
          setter.invoke(model,values);
        }
 else         if (JSONObject.class.isAssignableFrom(o.getClass())) {
          setter.invoke(model,unmarshallClass(param0.getClass(),(JSONObject)o));
        }
 else {
          setter.invoke(model,o);
        }
      }
    }
    return model;
  }
 catch (  Exception e) {
    throw new RuntimeException(e);
  }
}