Program: 20852
Project: 20852
Buggy source:
public void doFree(DownloadLink downloadLink) throws Exception, PluginException {
  String passCode=null;
  boolean resumable=false;
  int maxchunks=1;
  Form freeform=br.getFormBySubmitvalue("String_Node_Str");
  if (freeform == null) {
    freeform=br.getFormBySubmitvalue("String_Node_Str");
    if (freeform == null) {
      freeform=br.getFormbyKey("String_Node_Str");
    }
  }
  if (freeform != null) {
    freeform.remove("String_Node_Str");
    br.submitForm(freeform);
    doSomething();
  }
  checkErrors(downloadLink,false,passCode);
  String md5hash=new Regex(brbefore,"String_Node_Str").getMatch(0);
  if (md5hash != null) {
    md5hash=md5hash.trim();
    logger.info("String_Node_Str" + md5hash);
    downloadLink.setMD5Hash(md5hash);
  }
  br.setFollowRedirects(false);
  Form DLForm=br.getFormbyProperty("String_Node_Str","String_Node_Str");
  if (DLForm == null)   throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
  boolean password=false;
  boolean recaptcha=false;
  if (brbefore.contains(PASSWORDTEXT0) || brbefore.contains(PASSWORDTEXT1)) {
    password=true;
    logger.info("String_Node_Str");
  }
  if (brbefore.contains("String_Node_Str")) {
    logger.info("String_Node_Str");
    String[][] letters=new Regex(Encoding.htmlDecode(br.toString()),"String_Node_Str").getMatches();
    if (letters == null || letters.length == 0) {
      logger.warning("String_Node_Str");
      throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
    }
    SortedMap<Integer,String> capMap=new TreeMap<Integer,String>();
    for (    String[] letter : letters) {
      capMap.put(Integer.parseInt(letter[0]),letter[1]);
    }
    StringBuilder code=new StringBuilder();
    for (    String value : capMap.values()) {
      code.append(value);
    }
    DLForm.put("String_Node_Str",code.toString());
    logger.info("String_Node_Str" + code.toString() + "String_Node_Str");
  }
 else   if (brbefore.contains("String_Node_Str")) {
    logger.info("String_Node_Str");
    String[] sitelinks=HTMLParser.getHttpLinks(br.toString(),null);
    String captchaurl=null;
    if (sitelinks == null || sitelinks.length == 0) {
      logger.warning("String_Node_Str");
      throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
    }
    for (    String link : sitelinks) {
      if (link.contains("String_Node_Str")) {
        captchaurl=link;
        break;
      }
    }
    if (captchaurl == null) {
      logger.warning("String_Node_Str");
      throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
    }
    String code=getCaptchaCode(captchaurl,downloadLink);
    DLForm.put("String_Node_Str",code);
    logger.info("String_Node_Str" + code + "String_Node_Str");
  }
 else   if (brbefore.contains("String_Node_Str")) {
    logger.info("String_Node_Str");
    PluginForHost recplug=JDUtilities.getPluginForHost("String_Node_Str");
    jd.plugins.hoster.DirectHTTP.Recaptcha rc=((DirectHTTP)recplug).getReCaptcha(br);
    rc.parse();
    rc.load();
    File cf=rc.downloadCaptcha(getLocalCaptchaFile());
    String c=getCaptchaCode(cf,downloadLink);
    if (password) {
      passCode=handlePassword(passCode,rc.getForm(),downloadLink);
    }
    recaptcha=true;
    rc.setCode(c);
    logger.info("String_Node_Str" + c + "String_Node_Str");
  }
  if (!recaptcha) {
    if (password) {
      passCode=handlePassword(passCode,DLForm,downloadLink);
    }
    dl=jd.plugins.BrowserAdapter.openDownload(br,downloadLink,DLForm,resumable,maxchunks);
    logger.info("String_Node_Str");
  }
  boolean error=false;
  try {
    if (dl.getConnection().getContentType().contains("String_Node_Str"))     error=true;
  }
 catch (  Exception e) {
    error=true;
  }
  if (error) {
    br.followConnection();
    logger.info("String_Node_Str");
    doSomething();
    checkErrors(downloadLink,true,passCode);
    String dllink=getDllink();
    if (dllink == null) {
      logger.warning("String_Node_Str");
      throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
    }
    logger.info("String_Node_Str" + dllink + "String_Node_Str");
    dl=jd.plugins.BrowserAdapter.openDownload(br,downloadLink,dllink,resumable,maxchunks);
    if (dl.getConnection().getContentType().contains("String_Node_Str")) {
      logger.warning("String_Node_Str");
      br.followConnection();
      checkServerErrors();
      throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
    }
  }
  if (passCode != null) {
    downloadLink.setProperty("String_Node_Str",passCode);
  }
  dl.startDownload();
}

Fixed version (ground truth):
public void doFree(DownloadLink downloadLink) throws Exception, PluginException {
  String passCode=null;
  boolean resumable=false;
  int maxchunks=1;
  Form freeform=br.getFormBySubmitvalue("String_Node_Str");
  if (freeform == null) {
    freeform=br.getFormBySubmitvalue("String_Node_Str");
    if (freeform == null) {
      freeform=br.getFormbyKey("String_Node_Str");
    }
  }
  if (freeform != null) {
    freeform.remove("String_Node_Str");
    br.submitForm(freeform);
    doSomething();
  }
  checkErrors(downloadLink,false,passCode);
  String md5hash=new Regex(brbefore,"String_Node_Str").getMatch(0);
  if (md5hash != null) {
    md5hash=md5hash.trim();
    logger.info("String_Node_Str" + md5hash);
    downloadLink.setMD5Hash(md5hash);
  }
  br.setFollowRedirects(false);
  Form DLForm=br.getFormbyProperty("String_Node_Str","String_Node_Str");
  if (DLForm == null)   throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
  boolean password=false;
  boolean recaptcha=false;
  if (brbefore.contains(PASSWORDTEXT0) || brbefore.contains(PASSWORDTEXT1)) {
    password=true;
    logger.info("String_Node_Str");
  }
  if (brbefore.contains("String_Node_Str")) {
    logger.info("String_Node_Str");
    String[][] letters=new Regex(Encoding.htmlDecode(br.toString()),"String_Node_Str").getMatches();
    if (letters == null || letters.length == 0) {
      logger.warning("String_Node_Str");
      throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
    }
    SortedMap<Integer,String> capMap=new TreeMap<Integer,String>();
    for (    String[] letter : letters) {
      capMap.put(Integer.parseInt(letter[0]),letter[1]);
    }
    StringBuilder code=new StringBuilder();
    for (    String value : capMap.values()) {
      code.append(value);
    }
    DLForm.put("String_Node_Str",code.toString());
    logger.info("String_Node_Str" + code.toString() + "String_Node_Str");
  }
 else   if (brbefore.contains("String_Node_Str")) {
    logger.info("String_Node_Str");
    String[] sitelinks=HTMLParser.getHttpLinks(br.toString(),null);
    String captchaurl=null;
    if (sitelinks == null || sitelinks.length == 0) {
      logger.warning("String_Node_Str");
      throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
    }
    for (    String link : sitelinks) {
      if (link.contains("String_Node_Str")) {
        captchaurl=link;
        break;
      }
    }
    if (captchaurl == null) {
      logger.warning("String_Node_Str");
      throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
    }
    String code=getCaptchaCode(captchaurl,downloadLink);
    DLForm.put("String_Node_Str",code);
    logger.info("String_Node_Str" + code + "String_Node_Str");
  }
 else   if (brbefore.contains("String_Node_Str")) {
    logger.info("String_Node_Str");
    PluginForHost recplug=JDUtilities.getPluginForHost("String_Node_Str");
    jd.plugins.hoster.DirectHTTP.Recaptcha rc=((DirectHTTP)recplug).getReCaptcha(br);
    rc.parse();
    if (rc.getId() == null || rc.getId().isEmpty()) {
      String id=br.getRegex("String_Node_Str").getMatch(0);
      if (id == null) {
        logger.warning("String_Node_Str");
        throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
      }
      rc.setId(id);
    }
    rc.load();
    File cf=rc.downloadCaptcha(getLocalCaptchaFile());
    String c=getCaptchaCode(cf,downloadLink);
    if (password) {
      passCode=handlePassword(passCode,rc.getForm(),downloadLink);
    }
    recaptcha=true;
    rc.setCode(c);
    logger.info("String_Node_Str" + c + "String_Node_Str");
  }
  if (!recaptcha) {
    if (password) {
      passCode=handlePassword(passCode,DLForm,downloadLink);
    }
    dl=jd.plugins.BrowserAdapter.openDownload(br,downloadLink,DLForm,resumable,maxchunks);
    logger.info("String_Node_Str");
  }
  boolean error=false;
  try {
    if (dl.getConnection().getContentType().contains("String_Node_Str"))     error=true;
  }
 catch (  Exception e) {
    error=true;
  }
  if (error) {
    br.followConnection();
    logger.info("String_Node_Str");
    doSomething();
    checkErrors(downloadLink,true,passCode);
    String dllink=getDllink();
    if (dllink == null) {
      logger.warning("String_Node_Str");
      throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
    }
    logger.info("String_Node_Str" + dllink + "String_Node_Str");
    dl=jd.plugins.BrowserAdapter.openDownload(br,downloadLink,dllink,resumable,maxchunks);
    if (dl.getConnection().getContentType().contains("String_Node_Str")) {
      logger.warning("String_Node_Str");
      br.followConnection();
      checkServerErrors();
      throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
    }
  }
  if (passCode != null) {
    downloadLink.setProperty("String_Node_Str",passCode);
  }
  dl.startDownload();
}