Program: 89634
Project: 89634
Buggy source:
@Override public List<HarvestRunInfo> getHarvestRunInfo(long harvestID){
  Connection c=HarvestDBConnection.get();
  PreparedStatement s=null;
  try {
    ResultSet res=null;
    Map<Integer,HarvestRunInfo> runInfos=new HashMap<Integer,HarvestRunInfo>();
    List<HarvestRunInfo> infoList=new ArrayList<HarvestRunInfo>();
synchronized (this) {
      s=c.prepareStatement("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
      s.setLong(1,harvestID);
      res=s.executeQuery();
      while (res.next()) {
        int runNr=res.getInt(2);
        HarvestRunInfo info=runInfos.get(runNr);
        if (info == null) {
          String name=res.getString(1);
          info=new HarvestRunInfo(harvestID,name,runNr);
          runInfos.put(runNr,info);
          infoList.add(info);
        }
        JobStatus status=JobStatus.fromOrdinal(res.getInt(3));
        if (status != JobStatus.NEW && status != JobStatus.SUBMITTED && status != JobStatus.RESUBMITTED) {
          Date startDate=DBUtils.getDateMaybeNull(res,4);
          if (info.getStartDate() == null || (startDate != null && startDate.before(info.getStartDate()))) {
            info.setStartDate(startDate);
          }
        }
        if (status == JobStatus.DONE || status == JobStatus.FAILED) {
          Date endDate=DBUtils.getDateMaybeNull(res,5);
          if (info.getEndDate() == null || (endDate != null && endDate.after(info.getEndDate()))) {
            info.setEndDate(endDate);
          }
        }
        int count=res.getInt(6);
        info.setStatusCount(status,count);
      }
      s=c.prepareStatement("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
      s.setLong(1,harvestID);
      res=s.executeQuery();
    }
    while (res.next()) {
      final int harvestNum=res.getInt(1);
      HarvestRunInfo info=runInfos.get(harvestNum);
      info.setBytesHarvested(res.getLong(2));
      info.setDocsHarvested(res.getLong(3));
    }
    for (    HarvestRunInfo info : infoList) {
      if (info.getJobCount(JobStatus.STARTED) != 0 || info.getJobCount(JobStatus.NEW) != 0 || info.getJobCount(JobStatus.SUBMITTED) != 0) {
        info.setEndDate(null);
      }
    }
    return infoList;
  }
 catch (  SQLException e) {
    String message="String_Node_Str" + harvestID + "String_Node_Str"+ "String_Node_Str"+ ExceptionUtils.getSQLExceptionCause(e);
    log.warn(message,e);
    throw new IOFailure(message,e);
  }
 finally {
    HarvestDBConnection.release(c);
  }
}

Fixed version (ground truth):
@Override public List<HarvestRunInfo> getHarvestRunInfo(long harvestID){
  Connection c=HarvestDBConnection.get();
  PreparedStatement s=null;
  try {
    ResultSet res=null;
    Map<Integer,HarvestRunInfo> runInfos=new HashMap<Integer,HarvestRunInfo>();
    List<HarvestRunInfo> infoList=new ArrayList<HarvestRunInfo>();
    s=c.prepareStatement("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
    s.setLong(1,harvestID);
    res=s.executeQuery();
    while (res.next()) {
      int runNr=res.getInt(2);
      HarvestRunInfo info=runInfos.get(runNr);
      if (info == null) {
        String name=res.getString(1);
        info=new HarvestRunInfo(harvestID,name,runNr);
        runInfos.put(runNr,info);
        infoList.add(info);
      }
      JobStatus status=JobStatus.fromOrdinal(res.getInt(3));
      if (status != JobStatus.NEW && status != JobStatus.SUBMITTED && status != JobStatus.RESUBMITTED) {
        Date startDate=DBUtils.getDateMaybeNull(res,4);
        if (info.getStartDate() == null || (startDate != null && startDate.before(info.getStartDate()))) {
          info.setStartDate(startDate);
        }
      }
      if (status == JobStatus.DONE || status == JobStatus.FAILED) {
        Date endDate=DBUtils.getDateMaybeNull(res,5);
        if (info.getEndDate() == null || (endDate != null && endDate.after(info.getEndDate()))) {
          info.setEndDate(endDate);
        }
      }
      int count=res.getInt(6);
      info.setStatusCount(status,count);
    }
    s=c.prepareStatement("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
    s.setLong(1,harvestID);
    res=s.executeQuery();
    while (res.next()) {
      final int harvestNum=res.getInt(1);
      HarvestRunInfo info=runInfos.get(harvestNum);
      if (info != null) {
        info.setBytesHarvested(res.getLong(2));
        info.setDocsHarvested(res.getLong(3));
      }
 else {
        log.debug("String_Node_Str" + harvestNum + "String_Node_Str"+ harvestID+ "String_Node_Str");
      }
    }
    for (    HarvestRunInfo info : infoList) {
      if (info.getJobCount(JobStatus.STARTED) != 0 || info.getJobCount(JobStatus.NEW) != 0 || info.getJobCount(JobStatus.SUBMITTED) != 0) {
        info.setEndDate(null);
      }
    }
    return infoList;
  }
 catch (  SQLException e) {
    String message="String_Node_Str" + harvestID + "String_Node_Str"+ "String_Node_Str"+ ExceptionUtils.getSQLExceptionCause(e);
    log.warn(message,e);
    throw new IOFailure(message,e);
  }
 finally {
    HarvestDBConnection.release(c);
  }
}