Program: 177874
Project: 177874
Buggy source:
private ListResult<T> doListTypeRequest(HttpUriRequest request) throws SocializeException {
  List<T> results=null;
  List<ActionError> errors=null;
  HttpEntity entity=null;
  ListResult<T> result=null;
  try {
    HttpClient client=clientFactory.getClient();
    HttpResponse response=client.execute(request);
    entity=response.getEntity();
    if (httpUtils.isHttpError(response)) {
      if (sessionPersister != null && httpUtils.isAuthError(response)) {
        sessionPersister.delete(context);
      }
      String msg=ioUtils.readSafe(entity.getContent());
      throw new SocializeApiError(httpUtils,response.getStatusLine().getStatusCode(),msg);
    }
 else {
      result=new ListResult<T>();
      String json=ioUtils.readSafe(entity.getContent());
      if (logger != null && logger.isDebugEnabled()) {
        logger.debug("String_Node_Str" + json);
      }
      JSONObject object=jsonParser.parseObject(json);
      if (object.has(JSON_ATTR_ERRORS) && !object.isNull(JSON_ATTR_ERRORS)) {
        JSONArray errorList=object.getJSONArray(JSON_ATTR_ERRORS);
        int length=errorList.length();
        errors=new ArrayList<ActionError>(length);
        for (int i=0; i < length; i++) {
          JSONObject jsonObject=errorList.getJSONObject(i);
          ActionError error=errorFactory.fromJSON(jsonObject);
          errors.add(error);
        }
        result.setErrors(errors);
      }
      if (object.has(JSON_ATTR_ITEMS) && !object.isNull(JSON_ATTR_ITEMS)) {
        JSONArray list=object.getJSONArray(JSON_ATTR_ITEMS);
        int length=list.length();
        results=new ArrayList<T>(length);
        for (int i=0; i < length; i++) {
          results.add(objectFactory.fromJSON(list.getJSONObject(i)));
        }
        result.setItems(results);
      }
      if (object.has(JSON_ATTR_COUNT) && !object.isNull(JSON_ATTR_COUNT)) {
        result.setTotalCount(object.getInt(JSON_ATTR_COUNT));
      }
    }
  }
 catch (  Exception e) {
    if (e instanceof SocializeException) {
      throw (SocializeException)e;
    }
    throw new SocializeException(e);
  }
 finally {
    closeEntity(entity);
  }
  return result;
}

Fixed version (ground truth):
private ListResult<T> doListTypeRequest(HttpUriRequest request) throws SocializeException {
  List<T> results=null;
  List<ActionError> errors=null;
  HttpEntity entity=null;
  ListResult<T> result=null;
  try {
    HttpClient client=clientFactory.getClient();
    HttpResponse response=client.execute(request);
    entity=response.getEntity();
    if (httpUtils.isHttpError(response)) {
      if (sessionPersister != null && httpUtils.isAuthError(response)) {
        sessionPersister.delete(context);
      }
      String msg=ioUtils.readSafe(entity.getContent());
      throw new SocializeApiError(httpUtils,response.getStatusLine().getStatusCode(),msg);
    }
 else {
      result=new ListResult<T>();
      String json=ioUtils.readSafe(entity.getContent());
      if (logger != null && logger.isDebugEnabled()) {
        logger.debug("String_Node_Str" + json);
      }
      JSONObject object=jsonParser.parseObject(json);
      if (object.has(JSON_ATTR_ERRORS) && !object.isNull(JSON_ATTR_ERRORS)) {
        JSONArray errorList=object.getJSONArray(JSON_ATTR_ERRORS);
        int length=errorList.length();
        errors=new ArrayList<ActionError>(length);
        for (int i=0; i < length; i++) {
          JSONObject jsonObject=errorList.getJSONObject(i);
          ActionError error=errorFactory.fromJSON(jsonObject);
          errors.add(error);
        }
        result.setErrors(errors);
      }
      if (object.has(JSON_ATTR_ITEMS) && !object.isNull(JSON_ATTR_ITEMS)) {
        JSONArray list=object.getJSONArray(JSON_ATTR_ITEMS);
        int length=list.length();
        results=new ArrayList<T>(length);
        for (int i=0; i < length; i++) {
          results.add(objectFactory.fromJSON(list.getJSONObject(i)));
        }
        result.setItems(results);
      }
      if (object.has(JSON_ATTR_COUNT) && !object.isNull(JSON_ATTR_COUNT)) {
        result.setTotalCount(object.getInt(JSON_ATTR_COUNT));
      }
    }
  }
 catch (  Throwable e) {
    if (e instanceof SocializeException) {
      throw (SocializeException)e;
    }
    throw new SocializeException(e);
  }
 finally {
    closeEntity(entity);
  }
  return result;
}