Program: 21208
Project: 21208
Buggy source:
private void startLinkGatherer(){
class DThread extends Thread implements JDRunnable {
    private Vector<DownloadLink> links=null;
    public DThread(    Vector<DownloadLink> links){
      this.links=links;
    }
    public void run(){
      while (links.size() > 0 && gathererrunning == true) {
        DownloadLink link=links.remove(0);
        if (!guiConfig.getBooleanProperty(PROPERTY_ONLINE_CHECK,true)) {
          addingLinkList.add(link);
          try {
            Thread.sleep(5);
          }
 catch (          InterruptedException e) {
          }
        }
 else {
          if (!link.isAvailabilityChecked()) {
            Vector<DownloadLink> dlinks=new Vector<DownloadLink>();
            dlinks.add(link);
            dlinks.addAll(links);
            if (dlinks.size() > 1) {
              boolean[] ret=((PluginForHost)link.getPlugin()).checkLinks(dlinks.toArray(new DownloadLink[]{}));
              if (ret != null) {
                for (int i=0; i < dlinks.size(); i++) {
                  dlinks.get(i).setAvailable(ret[i]);
                }
              }
            }
          }
          link.isAvailable();
          addingLinkList.add(link);
        }
        progress.setValue(progress.getValue() + 1);
      }
    }
    public void go() throws Exception {
      run();
    }
  }
class AThread extends Thread {
    public AThread(){
    }
    public void run(){
      while (gathererrunning == true) {
        while (addingLinkList.size() > 0 && gathererrunning == true) {
          DownloadLink link=addingLinkList.remove(0);
          attachLinkToPackage(link);
          reprintTabbedPane();
        }
        reprintTabbedPane();
        try {
          Thread.sleep(500);
        }
 catch (        InterruptedException e) {
          break;
        }
      }
      while (addingLinkList.size() > 0) {
        DownloadLink link=addingLinkList.remove(0);
        attachLinkToPackage(link);
        reprintTabbedPane();
      }
    }
  }
  progress.setMaximum(0);
  progress.setString(null);
  if (gatherer != null && gatherer.isAlive()) {
    return;
  }
  gatherer=new Thread(){
    public synchronized void run(){
      gathererrunning=true;
      AThread athread=new AThread();
      athread.start();
      decryptJobbers=new Jobber(4);
      int maxperjob=20;
      while (waitingLinkList.size() > 0 && gathererrunning == true) {
        if (waitingLinkList.size() == 1) {
          maxperjob=4;
        }
 else {
          maxperjob=20;
        }
        Set<String> ks=waitingLinkList.keySet();
        String it=ks.iterator().next();
        Vector<DownloadLink> links=waitingLinkList.remove(it);
        Vector<DownloadLink> links2=new Vector<DownloadLink>();
        while (links.size() > 0) {
          links2.add(links.remove(0));
          if (links2.size() > maxperjob) {
            progress.setMaximum(progress.getMaximum() + links2.size());
            DThread dthread=new DThread(links2);
            decryptJobbers.add(dthread);
            links2=new Vector<DownloadLink>();
            break;
          }
        }
        links.addAll(links2);
        if (links.size() > maxperjob) {
          waitingLinkList.put(it + System.currentTimeMillis(),links);
        }
 else {
          progress.setMaximum(progress.getMaximum() + links.size());
          DThread dthread=new DThread(links);
          decryptJobbers.add(dthread);
        }
        if (!decryptJobbers.isAlive() && decryptJobbers.getJobsAdded() != decryptJobbers.getJobsFinished()) {
          decryptJobbers.start();
        }
      }
      int todo=decryptJobbers.getJobsAdded();
      while (decryptJobbers.getJobsFinished() != todo) {
        try {
          Thread.sleep(500);
        }
 catch (        InterruptedException e) {
          break;
        }
      }
      progress.setString(JDLocale.L("String_Node_Str","String_Node_Str"));
      decryptJobbers.stop();
      gathererrunning=false;
    }
  }
;
  gatherer.start();
}

Fixed version (ground truth):
private void startLinkGatherer(){
class DThread extends Thread implements JDRunnable {
    private Vector<DownloadLink> links=null;
    public DThread(    Vector<DownloadLink> links){
      this.links=links;
    }
    public void run(){
      while (links.size() > 0 && gathererrunning == true) {
        DownloadLink link=links.remove(0);
        if (!guiConfig.getBooleanProperty(PROPERTY_ONLINE_CHECK,true)) {
          addingLinkList.add(link);
          try {
            Thread.sleep(5);
          }
 catch (          InterruptedException e) {
          }
        }
 else {
          if (!link.isAvailabilityChecked()) {
            Vector<DownloadLink> dlinks=new Vector<DownloadLink>();
            dlinks.add(link);
            dlinks.addAll(links);
            if (dlinks.size() > 1) {
              boolean[] ret=((PluginForHost)link.getPlugin()).checkLinks(dlinks.toArray(new DownloadLink[]{}));
              if (ret != null) {
                for (int i=0; i < dlinks.size(); i++) {
                  dlinks.get(i).setAvailable(ret[i]);
                }
              }
            }
          }
          link.isAvailable();
          addingLinkList.add(link);
        }
        progress.setValue(progress.getValue() + 1);
      }
    }
    public void go() throws Exception {
      run();
    }
  }
class AThread extends Thread {
    public AThread(){
    }
    public void run(){
      while (gathererrunning == true) {
        while (addingLinkList.size() > 0 && gathererrunning == true) {
          DownloadLink link=addingLinkList.remove(0);
          attachLinkToPackage(link);
        }
        try {
          Thread.sleep(500);
        }
 catch (        InterruptedException e) {
          break;
        }
      }
      while (addingLinkList.size() > 0) {
        DownloadLink link=addingLinkList.remove(0);
        attachLinkToPackage(link);
      }
      reprintTabbedPane();
    }
  }
  progress.setMaximum(0);
  progress.setString(null);
  if (gatherer != null && gatherer.isAlive()) {
    return;
  }
  gatherer=new Thread(){
    public synchronized void run(){
      gathererrunning=true;
      AThread athread=new AThread();
      athread.start();
      decryptJobbers=new Jobber(4);
      int maxperjob=20;
      while (waitingLinkList.size() > 0 && gathererrunning == true) {
        if (waitingLinkList.size() == 1) {
          maxperjob=4;
        }
 else {
          maxperjob=20;
        }
        Set<String> ks=waitingLinkList.keySet();
        String it=ks.iterator().next();
        Vector<DownloadLink> links=waitingLinkList.remove(it);
        Vector<DownloadLink> links2=new Vector<DownloadLink>();
        while (links.size() > 0) {
          links2.add(links.remove(0));
          if (links2.size() > maxperjob) {
            progress.setMaximum(progress.getMaximum() + links2.size());
            DThread dthread=new DThread(links2);
            decryptJobbers.add(dthread);
            links2=new Vector<DownloadLink>();
            break;
          }
        }
        links.addAll(links2);
        if (links.size() > maxperjob) {
          waitingLinkList.put(it + System.currentTimeMillis(),links);
        }
 else {
          progress.setMaximum(progress.getMaximum() + links.size());
          DThread dthread=new DThread(links);
          decryptJobbers.add(dthread);
        }
        if (!decryptJobbers.isAlive() && decryptJobbers.getJobsAdded() != decryptJobbers.getJobsFinished()) {
          decryptJobbers.start();
        }
      }
      int todo=decryptJobbers.getJobsAdded();
      while (decryptJobbers.getJobsFinished() != todo) {
        try {
          Thread.sleep(500);
        }
 catch (        InterruptedException e) {
          break;
        }
      }
      progress.setString(JDLocale.L("String_Node_Str","String_Node_Str"));
      decryptJobbers.stop();
      gathererrunning=false;
    }
  }
;
  gatherer.start();
}