Program: 89747
Project: 89747
Buggy source:
/** 
 * Given the output of a checksum job, add the results to the database. The following fields in the table are updated for each corresponding  entry in the replicafileinfo table: <br/> - checksum = the given checksum.  <br/> - filelist_status = ok. <br/> - filelist_checkdatetime = now. <br/> - checksum_checkdatetime = now.
 * @param checksumOutput The output of a checksum job.
 * @param replica The replica this checksum job is for.
 */
@Override public void addChecksumInformation(List<String> checksumOutput,Replica replica){
  ArgumentNotValid.checkNotNull(checksumOutput,"String_Node_Str");
  ArgumentNotValid.checkNotNull(replica,"String_Node_Str");
  if (!existsReplicaInDB(replica)) {
    String msg="String_Node_Str" + replica.toString() + "String_Node_Str";
    log.warn(msg);
    throw new IOFailure(msg);
  }
  log.info("String_Node_Str" + checksumOutput.size() + "String_Node_Str"+ replica.getId());
  Collections.sort(checksumOutput);
  String lastFilename="String_Node_Str";
  String lastChecksum="String_Node_Str";
  for (  String line : checksumOutput) {
    KeyValuePair<String,String> entry=ChecksumJob.parseLine(line);
    String filename=entry.getKey();
    String checksum=entry.getValue();
    if (filename.equals(lastFilename)) {
      if (!checksum.equals(lastChecksum)) {
        String errMsg="String_Node_Str" + filename + "String_Node_Str"+ lastChecksum+ "String_Node_Str"+ checksum+ "String_Node_Str";
        log.error(errMsg);
        NotificationsFactory.getInstance().errorEvent(errMsg);
      }
 else {
        log.debug("String_Node_Str" + filename + "String_Node_Str"+ "String_Node_Str"+ checksum+ "String_Node_Str");
      }
      continue;
    }
    lastFilename=filename;
    lastChecksum=checksum;
    long fileid=-1;
    if (!existsFileInDB(filename)) {
      log.info("String_Node_Str" + filename + "String_Node_Str"+ "String_Node_Str");
      fileid=insertFileIntoDB(filename);
    }
 else {
      fileid=retrieveIdForFile(filename);
    }
    if (fileid < 0) {
      log.warn("String_Node_Str" + filename + "String_Node_Str"+ "String_Node_Str");
      fileid=insertFileIntoDB(filename);
    }
    long rfiId=retrieveReplicaFileInfoGuid(fileid,replica.getId());
    if (rfiId < 0) {
      createReplicaFileInfoEntriesInDB(fileid);
      log.info("String_Node_Str" + filename + "String_Node_Str"+ replica.toString()+ "String_Node_Str");
    }
    updateReplicaFileInfoChecksum(rfiId,checksum);
    log.trace("String_Node_Str" + filename + "String_Node_Str"+ replica.toString()+ "String_Node_Str");
  }
  updateChecksumDateForReplica(replica);
  updateFilelistDateForReplica(replica);
  log.info("String_Node_Str" + checksumOutput.size() + "String_Node_Str"+ replica.getId());
}

Fixed version (ground truth):
/** 
 * Given the output of a checksum job, add the results to the database. The following fields in the table are updated for each corresponding  entry in the replicafileinfo table: <br/> - checksum = the given checksum.  <br/> - filelist_status = ok. <br/> - filelist_checkdatetime = now. <br/> - checksum_checkdatetime = now.
 * @param checksumOutput The output of a checksum job.
 * @param replica The replica this checksum job is for.
 */
@Override public void addChecksumInformation(List<String> checksumOutput,Replica replica){
  ArgumentNotValid.checkNotNull(checksumOutput,"String_Node_Str");
  ArgumentNotValid.checkNotNull(replica,"String_Node_Str");
  if (!existsReplicaInDB(replica)) {
    String msg="String_Node_Str" + replica.toString() + "String_Node_Str";
    log.warn(msg);
    throw new IOFailure(msg);
  }
  log.info("String_Node_Str" + checksumOutput.size() + "String_Node_Str"+ replica.getId());
  Collections.sort(checksumOutput);
  List<Long> missingReplicaRFIs=retrieveReplicaFileInfoGuidsForReplica(replica.getId());
  String lastFilename="String_Node_Str";
  String lastChecksum="String_Node_Str";
  for (  String line : checksumOutput) {
    KeyValuePair<String,String> entry=ChecksumJob.parseLine(line);
    String filename=entry.getKey();
    String checksum=entry.getValue();
    if (filename.equals(lastFilename)) {
      if (!checksum.equals(lastChecksum)) {
        String errMsg="String_Node_Str" + filename + "String_Node_Str"+ lastChecksum+ "String_Node_Str"+ checksum+ "String_Node_Str";
        log.error(errMsg);
        NotificationsFactory.getInstance().errorEvent(errMsg);
      }
 else {
        log.debug("String_Node_Str" + filename + "String_Node_Str"+ "String_Node_Str"+ checksum+ "String_Node_Str");
      }
      continue;
    }
    lastFilename=filename;
    lastChecksum=checksum;
    long fileid=-1;
    if (!existsFileInDB(filename)) {
      log.info("String_Node_Str" + filename + "String_Node_Str"+ "String_Node_Str");
      fileid=insertFileIntoDB(filename);
    }
 else {
      fileid=retrieveIdForFile(filename);
    }
    if (fileid < 0) {
      log.warn("String_Node_Str" + filename + "String_Node_Str"+ "String_Node_Str");
      fileid=insertFileIntoDB(filename);
    }
    long rfiId=retrieveReplicaFileInfoGuid(fileid,replica.getId());
    if (rfiId < 0) {
      createReplicaFileInfoEntriesInDB(fileid);
      log.info("String_Node_Str" + filename + "String_Node_Str"+ replica.toString()+ "String_Node_Str");
    }
    updateReplicaFileInfoChecksum(rfiId,checksum);
    log.trace("String_Node_Str" + filename + "String_Node_Str"+ replica.toString()+ "String_Node_Str");
    missingReplicaRFIs.remove(rfiId);
  }
  if (missingReplicaRFIs.size() > 0) {
    log.warn("String_Node_Str" + missingReplicaRFIs.size() + "String_Node_Str"+ "String_Node_Str"+ replica+ "String_Node_Str");
    for (    long rfi : missingReplicaRFIs) {
      updateReplicaFileInfoMissingFromFilelist(rfi);
    }
  }
  updateChecksumDateForReplica(replica);
  updateFilelistDateForReplica(replica);
  log.info("String_Node_Str" + checksumOutput.size() + "String_Node_Str"+ replica.getId());
}