Program: 89866
Project: 89866
Buggy source:
/** 
 * Check that the checksum of the file is indeed different to the value in admin data and reference replica. If so, remove missing file and upload it from reference replica to this replica.
 * @param replica The replica to restore file to
 * @param filename The name of the file
 * @param credentials The credentials used to perform this replace operation
 * @param checksum  The known bad checksum. Only a file with this badchecksum is attempted repaired.
 * @throws IOFailure if the file cannot be reestablished.
 * @throws PermissionDenied if the file is not in correct state.
 * @throws ArgumentNotValid if any of the arguments are not valid.
 */
public void replaceChangedFile(Replica replica,String filename,String credentials,String checksum){
  ArgumentNotValid.checkNotNull(replica,"String_Node_Str");
  ArgumentNotValid.checkNotNullOrEmpty(filename,"String_Node_Str");
  ArgumentNotValid.checkNotNullOrEmpty(checksum,"String_Node_Str");
  ArgumentNotValid.checkNotNullOrEmpty(credentials,"String_Node_Str");
  if (replica.getType().equals(ReplicaType.BITARCHIVE)) {
    System.out.println("String_Node_Str");
    ArcRepositoryClientFactory.getPreservationInstance().removeAndGetFile(filename,replica.getId(),checksum,credentials);
    uploadMissingFiles(replica,filename);
  }
 else   if (replica.getType().equals(ReplicaType.CHECKSUM)) {
    System.out.println("String_Node_Str");
    Replica repWithFile=cache.getBitarchiveWithGoodFile(filename,replica);
    File missingFile=retrieveRemoteFile(filename,repWithFile);
    ArcRepositoryClientFactory.getPreservationInstance().correct(replica.getId(),checksum,missingFile,credentials);
  }
 else {
    String errMsg="String_Node_Str" + "String_Node_Str" + replica;
    log.warn(errMsg);
    throw new NotImplementedException(errMsg);
  }
}

Fixed version (ground truth):
/** 
 * Check that the checksum of the file is indeed different to the value in admin data and reference replica. If so, remove missing file and upload it from reference replica to this replica.
 * @param replica The replica to restore file to
 * @param filename The name of the file
 * @param credentials The credentials used to perform this replace operation
 * @param checksum  The known bad checksum. Only a file with this badchecksum is attempted repaired.
 * @throws IOFailure if the file cannot be reestablished.
 * @throws UnknownID if the file is not in correct state.
 * @throws ArgumentNotValid if any of the arguments are not valid.
 */
public void replaceChangedFile(Replica replica,String filename,String credentials,String checksum) throws UnknownID, IOFailure, ArgumentNotValid {
  ArgumentNotValid.checkNotNull(replica,"String_Node_Str");
  ArgumentNotValid.checkNotNullOrEmpty(filename,"String_Node_Str");
  ArgumentNotValid.checkNotNullOrEmpty(checksum,"String_Node_Str");
  ArgumentNotValid.checkNotNullOrEmpty(credentials,"String_Node_Str");
  if (replica.getType().equals(ReplicaType.BITARCHIVE)) {
    System.out.println("String_Node_Str");
    ArcRepositoryClientFactory.getPreservationInstance().removeAndGetFile(filename,replica.getId(),checksum,credentials);
    uploadMissingFiles(replica,filename);
  }
 else   if (replica.getType().equals(ReplicaType.CHECKSUM)) {
    System.out.println("String_Node_Str");
    Replica repWithFile=cache.getBitarchiveWithGoodFile(filename,replica);
    File missingFile=retrieveRemoteFile(filename,repWithFile);
    ArcRepositoryClientFactory.getPreservationInstance().correct(replica.getId(),checksum,missingFile,credentials);
  }
 else {
    String errMsg="String_Node_Str" + "String_Node_Str" + replica;
    log.warn(errMsg);
    throw new UnknownID(errMsg);
  }
}