Program: 89711
Project: 89711
Buggy source:
/** 
 * Write the contents of this ftp remote file to an output stream. Notice that while the checksum of the transferred data is checked, no retries are performed, and in case of failure, there is no guarantee that any data have been transferred.
 * @param out OutputStream that the data will be written to.  This streamwill not be closed by this operation.
 * @throws IOFailure If append operation fails
 */
public void appendTo(OutputStream out){
  ArgumentNotValid.checkNotNull(out,"String_Node_Str");
  if (filesize == 0) {
    return;
  }
  try {
    logOn();
    if (useChecksums) {
      out=new DigestOutputStream(out,MD5.getMessageDigestInstance());
    }
    if (!currentFTPClient.retrieveFile(ftpFileName,out)) {
      final String msg="String_Node_Str" + ftpFileName + "String_Node_Str"+ getFtpErrorMessage();
      log.warn(msg);
      throw new IOFailure(msg);
    }
    out.flush();
    if (useChecksums) {
      String newChecksum=MD5.toHex(((DigestOutputStream)out).getMessageDigest().digest());
      if (checksum != null && !checksum.equals(newChecksum)) {
        final String msg="String_Node_Str" + ftpFileName + "String_Node_Str"+ checksum+ "String_Node_Str"+ newChecksum;
        log.warn(msg);
        throw new IOFailure(msg);
      }
    }
  }
 catch (  IOException e) {
    final String msg="String_Node_Str" + ftpFileName + "String_Node_Str";
    log.warn(msg,e);
    throw new IOFailure(msg,e);
  }
 finally {
    logOut();
    if (!multipleDownloads) {
      cleanup();
    }
  }
}

Fixed version (ground truth):
/** 
 * Write the contents of this ftp remote file to an output stream. Notice that while the checksum of the transferred data is checked, no retries are performed, and in case of failure, there is no guarantee that any data have been transferred.
 * @param out OutputStream that the data will be written to.  This streamwill not be closed by this operation.
 * @throws IOFailure If append operation fails
 */
public void appendTo(OutputStream out){
  ArgumentNotValid.checkNotNull(out,"String_Node_Str");
  if (filesize == 0) {
    return;
  }
  try {
    logOn();
    if (useChecksums) {
      out=new DigestOutputStream(out,MD5.getMessageDigestInstance());
    }
    if (!currentFTPClient.retrieveFile(ftpFileName,out)) {
      final String msg="String_Node_Str" + ftpFileName + "String_Node_Str"+ getFtpErrorMessage();
      log.warn(msg);
      throw new IOFailure(msg);
    }
    out.flush();
    if (useChecksums) {
      String newChecksum=MD5.toHex(((DigestOutputStream)out).getMessageDigest().digest());
      if (checksum != null && !checksum.equals(newChecksum)) {
        final String msg="String_Node_Str" + ftpFileName + "String_Node_Str"+ checksum+ "String_Node_Str"+ newChecksum;
        log.warn(msg);
        throw new IOFailure(msg);
      }
    }
  }
 catch (  IOException e) {
    String msg="String_Node_Str" + ftpFileName + "String_Node_Str";
    if (e instanceof CopyStreamException) {
      CopyStreamException realException=(CopyStreamException)e;
      msg+="String_Node_Str" + realException.getIOException() + "String_Node_Str";
    }
    log.warn(msg,e);
    throw new IOFailure(msg,e);
  }
 finally {
    logOut();
    if (!multipleDownloads) {
      cleanup();
    }
  }
}