Program: 89709
Project: 89709
Buggy source:
/** 
 * Private constructor used by getInstance() static-method Tries to generate unique name on ftp-server.
 * @param localFile         File used to create new file on ftp-server.
 * @param useChecksums      If true, checksums will be used to checktransfers.
 * @param fileDeletable     If true, this file will be deleted after uploadto FTP.
 * @param multipleDownloads If true, the file will not be removed from FTPserver automatically after first download.
 * @throws IOFailure        if MD5 checksum fails, or ftp fails
 * @throws ArgumentNotValid if the local file cannot be read.
 */
private FTPRemoteFile(File localFile,boolean useChecksums,boolean fileDeletable,boolean multipleDownloads) throws IOFailure {
  super(localFile,useChecksums,fileDeletable,multipleDownloads);
  if (filesize == 0) {
    try {
      if (useChecksums) {
        checksum=MD5.generateMD5onFile(file);
      }
 else {
        checksum=null;
      }
      ftpFileName="String_Node_Str";
    }
 catch (    IOException e) {
      throw new IOFailure("String_Node_Str" + file.getAbsolutePath() + "String_Node_Str",e);
    }
  }
 else {
    if (ftpServerName.equalsIgnoreCase("String_Node_Str")) {
      ftpServerName=SystemUtils.getLocalHostName();
      log.debug("String_Node_Str" + SystemUtils.getLocalHostName() + "String_Node_Str"+ ftpServerName);
    }
    final int aMagicNumber=100000;
    ftpFileName=file.getName() + "String_Node_Str" + (int)(Math.random() * aMagicNumber)+ "String_Node_Str"+ new Date().getTime();
    InputStream in;
    try {
      in=new FileInputStream(localFile);
    }
 catch (    FileNotFoundException e) {
      final String message="String_Node_Str" + localFile + "String_Node_Str";
      log.debug(message,e);
      throw new IOFailure(message,e);
    }
    log.debug("String_Node_Str" + file.getName() + "String_Node_Str"+ ftpFileName+ "String_Node_Str"+ ftpServerName);
    try {
      logOn();
      if (useChecksums) {
        in=new DigestInputStream(in,MD5.getMessageDigestInstance());
      }
      boolean success=false;
      int tried=0;
      while (!success && tried < FTP_COPYTO_RETRIES) {
        tried++;
        try {
          success=currentFTPClient.storeFile(ftpFileName,in);
          if (!success) {
            log.debug("String_Node_Str" + tried + "String_Node_Str"+ FTP_COPYTO_RETRIES+ "String_Node_Str"+ getFtpErrorMessage());
          }
        }
 catch (        IOException e) {
          final String message="String_Node_Str" + ftpFileName + "String_Node_Str"+ tried+ "String_Node_Str"+ FTP_COPYTO_RETRIES;
          log.debug(message,e);
        }
      }
      if (!success) {
        final String msg="String_Node_Str" + localFile + "String_Node_Str"+ tried+ "String_Node_Str";
        log.warn(msg);
        throw new IOFailure(msg);
      }
      log.debug("String_Node_Str" + ftpFileName + "String_Node_Str");
      if (useChecksums) {
        checksum=MD5.toHex(((DigestInputStream)in).getMessageDigest().digest());
        log.debug("String_Node_Str" + ftpFileName + "String_Node_Str"+ checksum);
      }
 else {
        checksum=null;
      }
    }
  finally {
      try {
        if (in != null) {
          in.close();
        }
      }
 catch (      IOException e) {
        log.warn("String_Node_Str");
      }
      logOut();
      log.debug("String_Node_Str");
    }
  }
  if (fileDeletable) {
    try {
      FileUtils.removeRecursively(localFile);
    }
 catch (    IOFailure e) {
      log.warn("String_Node_Str" + localFile,e);
    }
  }
}

Fixed version (ground truth):
/** 
 * Private constructor used by getInstance() static-method Tries to generate unique name on ftp-server.
 * @param localFile         File used to create new file on ftp-server.
 * @param useChecksums      If true, checksums will be used to checktransfers.
 * @param fileDeletable     If true, this file will be deleted after uploadto FTP.
 * @param multipleDownloads If true, the file will not be removed from FTPserver automatically after first download.
 * @throws IOFailure        if MD5 checksum fails, or ftp fails
 * @throws ArgumentNotValid if the local file cannot be read.
 */
private FTPRemoteFile(File localFile,boolean useChecksums,boolean fileDeletable,boolean multipleDownloads) throws IOFailure {
  super(localFile,useChecksums,fileDeletable,multipleDownloads);
  if (filesize == 0) {
    try {
      if (useChecksums) {
        checksum=MD5.generateMD5onFile(file);
      }
 else {
        checksum=null;
      }
      ftpFileName="String_Node_Str";
    }
 catch (    IOException e) {
      String msg="String_Node_Str";
      if (e instanceof CopyStreamException) {
        CopyStreamException realException=(CopyStreamException)e;
        msg+="String_Node_Str" + realException.getIOException() + "String_Node_Str";
      }
      throw new IOFailure("String_Node_Str" + file.getAbsolutePath() + "String_Node_Str"+ msg,e);
    }
  }
 else {
    if (ftpServerName.equalsIgnoreCase("String_Node_Str")) {
      ftpServerName=SystemUtils.getLocalHostName();
      log.debug("String_Node_Str" + SystemUtils.getLocalHostName() + "String_Node_Str"+ ftpServerName);
    }
    final int aMagicNumber=100000;
    ftpFileName=file.getName() + "String_Node_Str" + (int)(Math.random() * aMagicNumber)+ "String_Node_Str"+ new Date().getTime();
    InputStream in;
    try {
      in=new FileInputStream(localFile);
    }
 catch (    FileNotFoundException e) {
      final String message="String_Node_Str" + localFile + "String_Node_Str";
      log.debug(message,e);
      throw new IOFailure(message,e);
    }
    log.debug("String_Node_Str" + file.getName() + "String_Node_Str"+ ftpFileName+ "String_Node_Str"+ ftpServerName);
    try {
      logOn();
      if (useChecksums) {
        in=new DigestInputStream(in,MD5.getMessageDigestInstance());
      }
      boolean success=false;
      int tried=0;
      while (!success && tried < FTP_COPYTO_RETRIES) {
        tried++;
        try {
          success=currentFTPClient.storeFile(ftpFileName,in);
          if (!success) {
            log.debug("String_Node_Str" + tried + "String_Node_Str"+ FTP_COPYTO_RETRIES+ "String_Node_Str"+ getFtpErrorMessage());
          }
        }
 catch (        IOException e) {
          String message="String_Node_Str" + ftpFileName + "String_Node_Str"+ tried+ "String_Node_Str"+ FTP_COPYTO_RETRIES;
          if (e instanceof CopyStreamException) {
            CopyStreamException realException=(CopyStreamException)e;
            message+="String_Node_Str" + realException.getIOException() + "String_Node_Str";
          }
          log.debug(message,e);
        }
      }
      if (!success) {
        final String msg="String_Node_Str" + localFile + "String_Node_Str"+ tried+ "String_Node_Str";
        log.warn(msg);
        throw new IOFailure(msg);
      }
      log.debug("String_Node_Str" + ftpFileName + "String_Node_Str");
      if (useChecksums) {
        checksum=MD5.toHex(((DigestInputStream)in).getMessageDigest().digest());
        log.debug("String_Node_Str" + ftpFileName + "String_Node_Str"+ checksum);
      }
 else {
        checksum=null;
      }
    }
  finally {
      try {
        if (in != null) {
          in.close();
        }
      }
 catch (      IOException e) {
        log.warn("String_Node_Str" + e);
      }
      logOut();
      log.debug("String_Node_Str");
    }
  }
  if (fileDeletable) {
    try {
      FileUtils.removeRecursively(localFile);
    }
 catch (    IOFailure e) {
      log.warn("String_Node_Str" + localFile,e);
    }
  }
}