Program: 89776
Project: 89776
Buggy source:
/** 
 * Method for correcting an entry in a replica. This is done by sending a correct message to the replica. The file which is removed from the replica is put into the tempDir.
 * @param replicaId The id of the replica to send the message.
 * @param checksum The checksum of the corrupt entry in the archive. It is important to validate that the checksum actually is wrong before  correcting the entry.
 * @param file The file to correct the entry in the archive of the replica.
 * @param credentials A string with the password for allowing changes insidean archive. If it does not correspond to the credentials of the archive,  the correction will not be allowed.
 * @throws IOFailure If the message is not handled properly.
 * @throws ArgumentNotValid If the replicaId, the checksum or the credentials are either null or empty, or if file is null.
 */
public File correct(String replicaId,String checksum,File file,String credentials) throws IOFailure, ArgumentNotValid {
  ArgumentNotValid.checkNotNullOrEmpty(replicaId,"String_Node_Str");
  ArgumentNotValid.checkNotNullOrEmpty(checksum,"String_Node_Str");
  ArgumentNotValid.checkNotNull(file,"String_Node_Str");
  ArgumentNotValid.checkNotNullOrEmpty(credentials,"String_Node_Str");
  RemoteFile rm=RemoteFileFactory.getCopyfileInstance(file);
  CorrectMessage correctMsg=new CorrectMessage(Channels.getTheRepos(),replyQ,checksum,rm,replicaId,credentials);
  CorrectMessage responseMessage=(CorrectMessage)sendAndWaitForOneReply(correctMsg,getTimeout);
  if (responseMessage == null) {
    throw new IOFailure("String_Node_Str" + "String_Node_Str");
  }
 else   if (!responseMessage.isOk()) {
    throw new IOFailure("String_Node_Str" + responseMessage.getErrMsg());
  }
  RemoteFile removedFile=responseMessage.getRemovedFile();
  try {
    File destFile=new File(FileUtils.getTempDir(),removedFile.getName());
    removedFile.copyTo(destFile);
    return destFile;
  }
 catch (  Throwable e) {
    String errMsg="String_Node_Str" + "String_Node_Str";
    log.warn(errMsg,e);
    throw new IOFailure(errMsg,e);
  }
}

Fixed version (ground truth):
/** 
 * Method for correcting an entry in a replica. This is done by sending a correct message to the replica. The file which is removed from the replica is put into the tempDir.
 * @param replicaId The id of the replica to send the message.
 * @param checksum The checksum of the corrupt entry in the archive. It is important to validate that the checksum actually is wrong before  correcting the entry.
 * @param file The file to correct the entry in the archive of the replica.
 * @param credentials A string with the password for allowing changes insidean archive. If it does not correspond to the credentials of the archive,  the correction will not be allowed.
 * @throws IOFailure If the message is not handled properly.
 * @throws ArgumentNotValid If the replicaId, the checksum or the credentials are either null or empty, or if file is null.
 */
public File correct(String replicaId,String checksum,File file,String credentials) throws IOFailure, ArgumentNotValid {
  ArgumentNotValid.checkNotNullOrEmpty(replicaId,"String_Node_Str");
  ArgumentNotValid.checkNotNullOrEmpty(checksum,"String_Node_Str");
  ArgumentNotValid.checkNotNull(file,"String_Node_Str");
  ArgumentNotValid.checkNotNullOrEmpty(credentials,"String_Node_Str");
  RemoteFile rm=RemoteFileFactory.getCopyfileInstance(file);
  CorrectMessage correctMsg=new CorrectMessage(Channels.getTheRepos(),replyQ,checksum,rm,replicaId,credentials);
  CorrectMessage responseMessage=(CorrectMessage)sendAndWaitForOneReply(correctMsg,0);
  if (responseMessage == null) {
    throw new IOFailure("String_Node_Str" + "String_Node_Str");
  }
 else   if (!responseMessage.isOk()) {
    throw new IOFailure("String_Node_Str" + responseMessage.getErrMsg());
  }
  RemoteFile removedFile=responseMessage.getRemovedFile();
  try {
    File destFile=new File(FileUtils.getTempDir(),removedFile.getName());
    removedFile.copyTo(destFile);
    return destFile;
  }
 catch (  Throwable e) {
    String errMsg="String_Node_Str" + "String_Node_Str";
    log.warn(errMsg,e);
    throw new IOFailure(errMsg,e);
  }
}