Program: 21168
Project: 21168
Buggy source:
private void confirmPackage(int idx,String host){
  PackageTab tab=tabList.get(idx);
  Vector<DownloadLink> linkList=tab.getLinkList();
  if (linkList.isEmpty())   return;
  FilePackage fp=new FilePackage();
  fp.setName(tab.getPackageName());
  fp.setComment(tab.getComment());
  fp.setPassword(tab.getPassword());
  fp.setExtractAfterDownload(tab.isExtract());
  addToDownloadDirs(tab.getDownloadDirectory(),tab.getPackageName());
  if (JDUtilities.getConfiguration().getBooleanProperty(Configuration.PARAM_USE_PACKETNAME_AS_SUBFOLDER,false)) {
    File file=new File(new File(tab.getDownloadDirectory()),tab.getPackageName());
    if (JDUtilities.getConfiguration().getBooleanProperty(Configuration.PARAM_CREATE_SUBFOLDER_BEFORE_DOWNLOAD,false)) {
      if (!file.exists())       file.mkdirs();
    }
 else {
      fp.setDownloadDirectory(file.getAbsolutePath());
    }
  }
 else {
    fp.setDownloadDirectory(tab.getDownloadDirectory());
  }
  int files=0;
  if (host == null) {
    files=linkList.size();
    fp.setDownloadLinks(linkList);
    for (    DownloadLink link : linkList) {
      boolean avail=true;
      if (link.isAvailabilityChecked())       avail=link.isAvailable();
      link.getLinkStatus().reset();
      if (!avail)       link.getLinkStatus().addStatus(LinkStatus.ERROR_FILE_NOT_FOUND);
      link.setFilePackage(fp);
    }
  }
 else {
    Vector<DownloadLink> linkListHost=new Vector<DownloadLink>();
    for (int i=tab.getLinkList().size() - 1; i >= 0; --i) {
      if (linkList.elementAt(i).getHost().compareTo(host) == 0) {
        DownloadLink link=linkList.remove(i);
        boolean avail=true;
        if (link.isAvailabilityChecked())         avail=link.isAvailable();
        link.getLinkStatus().reset();
        if (!avail)         link.getLinkStatus().addStatus(LinkStatus.ERROR_FILE_NOT_FOUND);
        totalLinkList.remove(link);
        linkListHost.add(link);
        link.setFilePackage(fp);
        ++files;
      }
    }
    if (files == 0)     return;
    fp.setDownloadLinks(linkListHost);
    tab.setLinkList(linkList);
  }
  parentFrame.fireUIEvent(new UIEvent(this,UIEvent.UI_PACKAGE_GRABBED,fp));
  if (mStartAfterAdding.isSelected())   parentFrame.fireUIEvent(new UIEvent(this,UIEvent.UI_START_DOWNLOADS,null));
  parentFrame.setDropTargetText(JDLocale.L("String_Node_Str","String_Node_Str") + files);
}

Fixed version (ground truth):
private void confirmPackage(int idx,String host){
  PackageTab tab=tabList.get(idx);
  Vector<DownloadLink> linkList=tab.getLinkList();
  if (linkList.isEmpty())   return;
  FilePackage fp=new FilePackage();
  fp.setName(tab.getPackageName());
  fp.setComment(tab.getComment());
  fp.setPassword(tab.getPassword());
  fp.setExtractAfterDownload(tab.isExtract());
  addToDownloadDirs(tab.getDownloadDirectory(),tab.getPackageName());
  if (JDUtilities.getConfiguration().getBooleanProperty(Configuration.PARAM_USE_PACKETNAME_AS_SUBFOLDER,false)) {
    File file=new File(new File(tab.getDownloadDirectory()),tab.getPackageName());
    if (JDUtilities.getConfiguration().getBooleanProperty(Configuration.PARAM_CREATE_SUBFOLDER_BEFORE_DOWNLOAD,false)) {
      if (!file.exists())       file.mkdirs();
    }
    fp.setDownloadDirectory(file.getAbsolutePath());
  }
 else {
    fp.setDownloadDirectory(tab.getDownloadDirectory());
  }
  int files=0;
  if (host == null) {
    files=linkList.size();
    fp.setDownloadLinks(linkList);
    for (    DownloadLink link : linkList) {
      boolean avail=true;
      if (link.isAvailabilityChecked())       avail=link.isAvailable();
      link.getLinkStatus().reset();
      if (!avail)       link.getLinkStatus().addStatus(LinkStatus.ERROR_FILE_NOT_FOUND);
      link.setFilePackage(fp);
    }
  }
 else {
    Vector<DownloadLink> linkListHost=new Vector<DownloadLink>();
    for (int i=tab.getLinkList().size() - 1; i >= 0; --i) {
      if (linkList.elementAt(i).getHost().compareTo(host) == 0) {
        DownloadLink link=linkList.remove(i);
        boolean avail=true;
        if (link.isAvailabilityChecked())         avail=link.isAvailable();
        link.getLinkStatus().reset();
        if (!avail)         link.getLinkStatus().addStatus(LinkStatus.ERROR_FILE_NOT_FOUND);
        totalLinkList.remove(link);
        linkListHost.add(link);
        link.setFilePackage(fp);
        ++files;
      }
    }
    if (files == 0)     return;
    fp.setDownloadLinks(linkListHost);
    tab.setLinkList(linkList);
  }
  parentFrame.fireUIEvent(new UIEvent(this,UIEvent.UI_PACKAGE_GRABBED,fp));
  if (mStartAfterAdding.isSelected())   parentFrame.fireUIEvent(new UIEvent(this,UIEvent.UI_START_DOWNLOADS,null));
  parentFrame.setDropTargetText(JDLocale.L("String_Node_Str","String_Node_Str") + files);
}