Program: 21178
Project: 21178
Buggy source:
private void confirmPackage(int idx,String host){
  PackageTab tab=tabList.get(idx);
  Vector<DownloadLink> linkList=tab.getLinkList();
  int files=linkList.size();
  if (files == 0) {
    return;
  }
  Color c=new Color((int)(Math.random() * 0xffffff));
  c=c.brighter();
  FilePackage fp=new FilePackage();
  fp.setProperty("String_Node_Str",c);
  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());
    fp.setDownloadDirectory(file.getAbsolutePath());
  }
 else {
    fp.setDownloadDirectory(tab.getDownloadDirectory());
  }
  if (host == null) {
    fp.setDownloadLinks(linkList);
    for (int i=0; i < files; i++) {
      linkList.elementAt(i).setFilePackage(fp);
    }
  }
 else {
    Vector<DownloadLink> linkListHost=new Vector<DownloadLink>();
    files=0;
    for (int i=tab.getLinkList().size() - 1; i >= 0; --i) {
      if (linkList.elementAt(i).getHost().compareTo(host) == 0) {
        DownloadLink link=linkList.remove(i);
        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();
  int files=linkList.size();
  if (files == 0) {
    return;
  }
  Color c=new Color((int)(Math.random() * 0xffffff));
  c=c.brighter();
  FilePackage fp=new FilePackage();
  fp.setProperty("String_Node_Str",c);
  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());
  }
  if (host == null) {
    fp.setDownloadLinks(linkList);
    for (int i=0; i < files; i++) {
      linkList.elementAt(i).setFilePackage(fp);
    }
  }
 else {
    Vector<DownloadLink> linkListHost=new Vector<DownloadLink>();
    files=0;
    for (int i=tab.getLinkList().size() - 1; i >= 0; --i) {
      if (linkList.elementAt(i).getHost().compareTo(host) == 0) {
        DownloadLink link=linkList.remove(i);
        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);
}