Program: 20975
Project: 20975
Buggy source:
public void download(String ftpurl,final DownloadLink downloadLink) throws IOException, PluginException {
  SimpleFTP ftp=new SimpleFTP();
  try {
    if (new File(downloadLink.getFileOutput()).exists())     throw new PluginException(LinkStatus.ERROR_ALREADYEXISTS);
    URL url=new URL(ftpurl);
    ftp.connect(url);
    String path=url.getPath().substring(0,url.getPath().lastIndexOf("String_Node_Str"));
    if (path.length() > 0)     ftp.cwd(path);
    ftp.bin();
    ftp.getBroadcaster().addListener(new FtpListener(){
      private long last=0;
      private long lastTime=System.currentTimeMillis();
      public void onDownloadProgress(      FtpEvent event){
        downloadLink.setDownloadCurrent(event.getProgress());
        if (System.currentTimeMillis() - lastTime > 250) {
          downloadLink.getDownloadInstance().getChunks().get(0).getSpeedMeter().addSpeedValue((event.getProgress() - last),System.currentTimeMillis() - lastTime);
          downloadLink.requestGuiUpdate();
          last=event.getProgress();
          lastTime=System.currentTimeMillis();
          downloadLink.setChunksProgress(new long[]{last});
        }
      }
    }
);
    File tmp;
    dl=new RAFDownload(this,downloadLink,null);
    dl.setResume(false);
    downloadLink.setDownloadInstance(dl);
    dl.addChunksDownloading(1);
    Chunk ch=dl.new Chunk(0,0,null,null);
    ch.setInProgress(true);
    dl.getChunks().add(ch);
    downloadLink.getLinkStatus().addStatus(LinkStatus.DOWNLOADINTERFACE_IN_PROGRESS);
    try {
      ftp.download(downloadLink.getName(),tmp=new File(downloadLink.getFileOutput() + "String_Node_Str"));
    }
  finally {
      downloadLink.getLinkStatus().removeStatus(LinkStatus.DOWNLOADINTERFACE_IN_PROGRESS);
      downloadLink.setDownloadInstance(null);
      ch.setInProgress(false);
    }
    if (tmp.length() != downloadLink.getDownloadSize()) {
      tmp.delete();
      throw new PluginException(LinkStatus.ERROR_DOWNLOAD_INCOMPLETE);
    }
    if (downloadLink.getMD5Hash() != null && !downloadLink.getMD5Hash().equalsIgnoreCase(JDHash.getMD5(tmp))) {
      throw new PluginException(LinkStatus.ERROR_DOWNLOAD_FAILED,"String_Node_Str");
    }
    if (downloadLink.getSha1Hash() != null && !downloadLink.getSha1Hash().equalsIgnoreCase(JDHash.getSHA1(tmp))) {
      throw new PluginException(LinkStatus.ERROR_DOWNLOAD_FAILED,"String_Node_Str");
    }
    if (!tmp.renameTo(new File(downloadLink.getFileOutput()))) {
      throw new PluginException(LinkStatus.ERROR_DOWNLOAD_FAILED,"String_Node_Str");
    }
    downloadLink.getLinkStatus().addStatus(LinkStatus.FINISHED);
  }
  finally {
    ftp.disconnect();
  }
}

Fixed version (ground truth):
public void download(String ftpurl,final DownloadLink downloadLink) throws IOException, PluginException {
  SimpleFTP ftp=new SimpleFTP();
  try {
    if (new File(downloadLink.getFileOutput()).exists())     throw new PluginException(LinkStatus.ERROR_ALREADYEXISTS);
    URL url=new URL(ftpurl);
    ftp.connect(url);
    String path=url.getPath().substring(0,url.getPath().lastIndexOf("String_Node_Str"));
    if (path.length() > 0)     ftp.cwd(path);
    ftp.bin();
    ftp.getBroadcaster().addListener(new FtpListener(){
      private long last=0;
      private long lastTime=System.currentTimeMillis();
      public void onDownloadProgress(      FtpEvent event){
        downloadLink.setDownloadCurrent(event.getProgress());
        if (System.currentTimeMillis() - lastTime > 250) {
          downloadLink.getDownloadInstance().getChunks().get(0).getSpeedMeter().addSpeedValue((event.getProgress() - last),System.currentTimeMillis() - lastTime);
          downloadLink.requestGuiUpdate();
          last=event.getProgress();
          lastTime=System.currentTimeMillis();
          downloadLink.setChunksProgress(new long[]{last});
        }
      }
    }
);
    File tmp;
    dl=new RAFDownload(this,downloadLink,null);
    dl.setResume(false);
    downloadLink.setDownloadInstance(dl);
    dl.addChunksDownloading(1);
    Chunk ch=dl.new Chunk(0,0,null,null);
    ch.setInProgress(true);
    dl.getChunks().add(ch);
    String name=new Regex(ftpurl,"String_Node_Str").getMatch(0);
    if (name == null) {
      logger.severe("String_Node_Str");
      name=downloadLink.getName();
    }
    downloadLink.getLinkStatus().addStatus(LinkStatus.DOWNLOADINTERFACE_IN_PROGRESS);
    try {
      ftp.download(name,tmp=new File(downloadLink.getFileOutput() + "String_Node_Str"));
    }
  finally {
      downloadLink.getLinkStatus().removeStatus(LinkStatus.DOWNLOADINTERFACE_IN_PROGRESS);
      downloadLink.setDownloadInstance(null);
      ch.setInProgress(false);
    }
    if (tmp.length() != downloadLink.getDownloadSize()) {
      tmp.delete();
      throw new PluginException(LinkStatus.ERROR_DOWNLOAD_INCOMPLETE);
    }
    if (downloadLink.getMD5Hash() != null && !downloadLink.getMD5Hash().equalsIgnoreCase(JDHash.getMD5(tmp))) {
      throw new PluginException(LinkStatus.ERROR_DOWNLOAD_FAILED,"String_Node_Str");
    }
    if (downloadLink.getSha1Hash() != null && !downloadLink.getSha1Hash().equalsIgnoreCase(JDHash.getSHA1(tmp))) {
      throw new PluginException(LinkStatus.ERROR_DOWNLOAD_FAILED,"String_Node_Str");
    }
    if (!tmp.renameTo(new File(downloadLink.getFileOutput()))) {
      throw new PluginException(LinkStatus.ERROR_DOWNLOAD_FAILED,"String_Node_Str");
    }
    downloadLink.getLinkStatus().addStatus(LinkStatus.FINISHED);
  }
  finally {
    ftp.disconnect();
  }
}