Program: 21182
Project: 21182
Buggy source:
public ArrayList<DownloadLink> getAvailableDownloads(DownloadLink downloadLink,int activeCaptchas) throws Exception {
  LinkStatus linkStatus=downloadLink.getLinkStatus();
  this.downloadLink=downloadLink;
  String link=(String)downloadLink.getProperty("String_Node_Str");
  String[] mirrors=(String[])downloadLink.getProperty("String_Node_Str");
  int c=0;
  while (active > activeCaptchas) {
    if (c++ == 120)     break;
    Thread.sleep(100);
  }
  downloadLink.getLinkStatus().setStatusText("String_Node_Str");
  downloadLink.requestGuiUpdate();
  ArrayList<DownloadLink> dls=getDLinks(link);
  if (dls.size() < 1) {
    linkStatus.addStatus(LinkStatus.ERROR_PLUGIN_DEFEKT);
    if (linkStatus.getErrorMessage() == null || linkStatus.getErrorMessage().endsWith("String_Node_Str"))     linkStatus.setErrorMessage(JDLocale.L("String_Node_Str","String_Node_Str"));
    logger.warning("String_Node_Str");
    return null;
  }
  Vector<Integer> down=new Vector<Integer>();
  Vector<DownloadLink> ret=new Vector<DownloadLink>();
  ArrayList<DownloadLink> fp=new ArrayList<DownloadLink>();
  for (int i=dls.size() - 1; i >= 0; i--) {
    DistributeData distributeData=new DistributeData(dls.get(i).getDownloadURL());
    Vector<DownloadLink> links=distributeData.findLinks();
    boolean online=false;
    DownloadLink[] it2=links.toArray(new DownloadLink[links.size()]);
    if (it2.length > 0) {
      boolean[] re=it2[0].getPlugin().checkLinks(it2);
      if (re == null || re.length != it2.length) {
        re=new boolean[it2.length];
        for (int j=0; j < re.length; j++) {
          re[j]=it2[j].isAvailable();
        }
      }
      for (int j=0; j < it2.length; j++) {
        if (re[j]) {
          fp.add(it2[j]);
          online=true;
        }
 else         down.add(j);
      }
      if (online) {
        ret.addAll(links);
      }
    }
  }
  if (mirrors != null) {
    for (    String element : mirrors) {
      if (down.size() > 0) {
        try {
          dls=getDLinks(element);
          Iterator<Integer> iter=down.iterator();
          while (iter.hasNext()) {
            Integer integer=(Integer)iter.next();
            DistributeData distributeData=new DistributeData(dls.get(integer).getDownloadURL());
            Vector<DownloadLink> links=distributeData.findLinks();
            DownloadLink[] it2=links.toArray(new DownloadLink[links.size()]);
            if (it2.length > 0) {
              boolean online=false;
              boolean[] re=it2[0].getPlugin().checkLinks(it2);
              if (re == null || re.length != it2.length) {
                re=new boolean[it2.length];
                for (int j=0; j < re.length; j++) {
                  re[j]=it2[j].isAvailable();
                }
              }
              for (int i=0; i < it2.length; i++) {
                if (re[i]) {
                  fp.add(it2[i]);
                  online=true;
                  iter.remove();
                }
              }
              if (online) {
                ret.addAll(links);
              }
            }
          }
        }
 catch (        Exception e) {
          e.printStackTrace();
        }
      }
 else {
        break;
      }
    }
  }
  if (down.size() > 0) {
    linkStatus.addStatus(LinkStatus.ERROR_FATAL);
    linkStatus.setErrorMessage(JDLocale.L("String_Node_Str","String_Node_Str"));
    return null;
  }
  Iterator<DownloadLink> fpi=fp.iterator();
  while (fpi.hasNext()) {
    fpi.next().addSourcePluginPasswords(passwords);
  }
  return fp;
}

Fixed version (ground truth):
public ArrayList<DownloadLink> getAvailableDownloads(DownloadLink downloadLink,int activeCaptchas) throws Exception {
  LinkStatus linkStatus=downloadLink.getLinkStatus();
  this.downloadLink=downloadLink;
  String link=(String)downloadLink.getProperty("String_Node_Str");
  String[] mirrors=(String[])downloadLink.getProperty("String_Node_Str");
  int c=0;
  while (active > activeCaptchas) {
    if (c++ == 120)     break;
    Thread.sleep(100);
  }
  downloadLink.getLinkStatus().setStatusText("String_Node_Str");
  downloadLink.requestGuiUpdate();
  ArrayList<DownloadLink> dls=getDLinks(link);
  if (dls.size() < 1) {
    linkStatus.addStatus(LinkStatus.ERROR_PLUGIN_DEFEKT);
    if (linkStatus.getErrorMessage() == null || linkStatus.getErrorMessage().endsWith("String_Node_Str"))     linkStatus.setErrorMessage(JDLocale.L("String_Node_Str","String_Node_Str"));
    logger.warning("String_Node_Str");
    return null;
  }
  ArrayList<DownloadLink> finaldls=new ArrayList<DownloadLink>();
  for (  DownloadLink dls2 : dls) {
    DistributeData distributeData=new DistributeData(dls2.getDownloadURL());
    finaldls.addAll(distributeData.findLinks());
  }
  if (finaldls.size() > 0) {
    try {
      DownloadLink[] linksar=finaldls.toArray(new DownloadLink[finaldls.size()]);
      linksar[0].getPlugin().checkLinks(linksar);
      for (      DownloadLink downloadLink2 : linksar) {
        if (!downloadLink2.isAvailable()) {
          finaldls=null;
          break;
        }
      }
    }
 catch (    Exception e) {
      finaldls=null;
    }
  }
  if (mirrors != null && finaldls == null) {
    for (    String element : mirrors) {
      try {
        dls=getDLinks(element);
        finaldls=new ArrayList<DownloadLink>();
        for (        DownloadLink dls2 : dls) {
          DistributeData distributeData=new DistributeData(dls2.getDownloadURL());
          finaldls.addAll(distributeData.findLinks());
        }
        if (finaldls.size() > 0) {
          try {
            DownloadLink[] linksar=finaldls.toArray(new DownloadLink[finaldls.size()]);
            linksar[0].getPlugin().checkLinks(linksar);
            for (            DownloadLink downloadLink2 : linksar) {
              if (!downloadLink2.isAvailable()) {
                finaldls=null;
                break;
              }
            }
          }
 catch (          Exception e) {
            finaldls=null;
          }
        }
      }
 catch (      Exception e) {
        finaldls=null;
        e.printStackTrace();
      }
      if (finaldls != null)       break;
    }
  }
  if (finaldls == null) {
    linkStatus.addStatus(LinkStatus.ERROR_FATAL);
    linkStatus.setErrorMessage(JDLocale.L("String_Node_Str","String_Node_Str"));
    return null;
  }
  for (  DownloadLink downloadLink2 : finaldls) {
    downloadLink2.addSourcePluginPasswords(passwords);
  }
  return finaldls;
}