Program: 89741
Project: 89741
Buggy source:
/** 
 * Method for adding the results from a list of filenames on a replica. This list of filenames should return the list of all the files within  the database.  For each file in the FileListJob the following fields are set for the  corresponding entry in the replicafileinfo table:  <br/> - filelist_status = ok. <br/> - filelist_checkdatetime = now. For each entry in the replicafileinfo table for the replica which are  missing in the results from the FileListJob the following fields are  assigned the following values: <br/> - filelist_status = missing. <br/> - filelist_checkdatetime = now.
 * @param filelist The list of filenames either parsed from a FilelistJob or the result from a GetAllFilenamesMessage.
 * @param replica The replica, which the FilelistBatchjob has run upon.
 * @throws ArgumentNotValid If the filelist or the replica is null.
 */
@Override public void addFileListInformation(List<String> filelist,Replica replica) throws ArgumentNotValid {
  ArgumentNotValid.checkNotNull(filelist,"String_Node_Str");
  ArgumentNotValid.checkNotNull(replica,"String_Node_Str");
  List<Long> missingReplicaRFIs=retrieveReplicaFileInfoGuidsForReplica(replica.getId());
  Collections.sort(filelist);
  String lastFileName="String_Node_Str";
  for (  String file : filelist) {
    if (file.equals(lastFileName)) {
      log.warn("String_Node_Str" + file + "String_Node_Str");
      continue;
    }
    lastFileName=file;
    long fileId=retrieveIdForFile(file);
    if (fileId < 0) {
      log.info("String_Node_Str" + file + "String_Node_Str"+ "String_Node_Str");
      fileId=insertFileIntoDB(file);
    }
    long rfiId=retrieveReplicaFileInfoGuid(fileId,replica.getId());
    if (rfiId < 0) {
      log.warn("String_Node_Str" + file + "String_Node_Str"+ "String_Node_Str"+ replica.getId()+ "String_Node_Str"+ "String_Node_Str");
      createReplicaFileInfoEntriesInDB(fileId);
    }
    missingReplicaRFIs.remove(rfiId);
    updateReplicaFileInfoFilelist(rfiId);
  }
  for (  long rfi : missingReplicaRFIs) {
    updateReplicaFileInfoMissingFromFilelist(rfi);
  }
  updateFilelistDateForReplica(replica);
}

Fixed version (ground truth):
/** 
 * Method for adding the results from a list of filenames on a replica. This list of filenames should return the list of all the files within  the database.  For each file in the FileListJob the following fields are set for the  corresponding entry in the replicafileinfo table:  <br/> - filelist_status = ok. <br/> - filelist_checkdatetime = now. For each entry in the replicafileinfo table for the replica which are  missing in the results from the FileListJob the following fields are  assigned the following values: <br/> - filelist_status = missing. <br/> - filelist_checkdatetime = now.
 * @param filelist The list of filenames either parsed from a FilelistJob or the result from a GetAllFilenamesMessage.
 * @param replica The replica, which the FilelistBatchjob has run upon.
 * @throws ArgumentNotValid If the filelist or the replica is null.
 */
@Override public void addFileListInformation(List<String> filelist,Replica replica) throws ArgumentNotValid {
  ArgumentNotValid.checkNotNull(filelist,"String_Node_Str");
  ArgumentNotValid.checkNotNull(replica,"String_Node_Str");
  List<Long> missingReplicaRFIs=retrieveReplicaFileInfoGuidsForReplica(replica.getId());
  Collections.sort(filelist);
  String lastFileName="String_Node_Str";
  int i=0;
  for (  String file : filelist) {
    if (i % 10000 == 0) {
      log.info("String_Node_Str" + i + "String_Node_Str"+ replica);
    }
    i++;
    if (file.equals(lastFileName)) {
      log.warn("String_Node_Str" + file + "String_Node_Str");
      continue;
    }
    lastFileName=file;
    long fileId=retrieveIdForFile(file);
    if (fileId < 0) {
      log.info("String_Node_Str" + file + "String_Node_Str"+ "String_Node_Str");
      fileId=insertFileIntoDB(file);
    }
    long rfiId=retrieveReplicaFileInfoGuid(fileId,replica.getId());
    if (rfiId < 0) {
      log.warn("String_Node_Str" + file + "String_Node_Str"+ "String_Node_Str"+ replica.getId()+ "String_Node_Str"+ "String_Node_Str");
      createReplicaFileInfoEntriesInDB(fileId);
    }
    missingReplicaRFIs.remove(rfiId);
    updateReplicaFileInfoFilelist(rfiId);
  }
  for (  long rfi : missingReplicaRFIs) {
    updateReplicaFileInfoMissingFromFilelist(rfi);
  }
  updateFilelistDateForReplica(replica);
}