Program: 20689
Project: 20689
Buggy source:
public void doFree(DownloadLink downloadLink,boolean resumable,int maxchunks) throws Exception, PluginException {
  String dllink=null;
  String passCode=null;
  if (BRBEFORE.contains("String_Node_Str")) {
    br.postPage(downloadLink.getDownloadURL(),"String_Node_Str" + new Regex(downloadLink.getDownloadURL(),COOKIE_HOST.replace("String_Node_Str","String_Node_Str") + "String_Node_Str" + "String_Node_Str").getMatch(0) + "String_Node_Str"+ Encoding.urlEncode(downloadLink.getName())+ "String_Node_Str");
    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);
  dllink=getDllink();
  if (dllink == null) {
    Form dlForm=br.getFormbyProperty("String_Node_Str","String_Node_Str");
    if (dlForm == null)     throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
    long timeBefore=System.currentTimeMillis();
    boolean password=false;
    boolean skipWaittime=false;
    if (new Regex(BRBEFORE,PASSWORDTEXT).matches()) {
      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 (new Regex(BRBEFORE,"String_Node_Str").matches()) {
      logger.info("String_Node_Str");
      PluginForHost recplug=JDUtilities.getPluginForHost("String_Node_Str");
      jd.plugins.hoster.DirectHTTP.Recaptcha rc=((DirectHTTP)recplug).getReCaptcha(br);
      rc.setForm(dlForm);
      rc.findID();
      rc.load();
      File cf=rc.downloadCaptcha(getLocalCaptchaFile());
      String c=getCaptchaCode(cf,downloadLink);
      rc.prepareForm(c);
      logger.info("String_Node_Str" + c + "String_Node_Str");
      dlForm=rc.getForm();
      skipWaittime=true;
    }
    if (password)     passCode=handlePassword(passCode,dlForm,downloadLink);
    if (!skipWaittime)     waitTime(timeBefore,downloadLink);
    br.submitForm(dlForm);
    logger.info("String_Node_Str");
    doSomething();
    checkErrors(downloadLink,true,passCode);
    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,boolean resumable,int maxchunks) throws Exception, PluginException {
  String dllink=null;
  String passCode=null;
  if (BRBEFORE.contains("String_Node_Str")) {
    br.postPage(downloadLink.getDownloadURL(),"String_Node_Str" + new Regex(downloadLink.getDownloadURL(),COOKIE_HOST.replace("String_Node_Str","String_Node_Str") + "String_Node_Str" + "String_Node_Str").getMatch(0) + "String_Node_Str"+ Encoding.urlEncode(downloadLink.getName())+ "String_Node_Str");
    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);
  dllink=getDllink();
  if (dllink == null) {
    Form dlForm=br.getFormbyProperty("String_Node_Str","String_Node_Str");
    if (dlForm == null)     throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
    long timeBefore=System.currentTimeMillis();
    boolean password=false;
    boolean skipWaittime=false;
    if (new Regex(BRBEFORE,PASSWORDTEXT).matches()) {
      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 (new Regex(BRBEFORE,"String_Node_Str").matches()) {
      logger.info("String_Node_Str");
      PluginForHost recplug=JDUtilities.getPluginForHost("String_Node_Str");
      jd.plugins.hoster.DirectHTTP.Recaptcha rc=((DirectHTTP)recplug).getReCaptcha(br);
      rc.setForm(dlForm);
      String id=this.br.getRegex("String_Node_Str").getMatch(0);
      rc.setId(id);
      rc.load();
      File cf=rc.downloadCaptcha(getLocalCaptchaFile());
      String c=getCaptchaCode(cf,downloadLink);
      rc.prepareForm(c);
      logger.info("String_Node_Str" + c + "String_Node_Str");
      dlForm=rc.getForm();
      skipWaittime=true;
    }
    if (password)     passCode=handlePassword(passCode,dlForm,downloadLink);
    if (!skipWaittime)     waitTime(timeBefore,downloadLink);
    br.submitForm(dlForm);
    logger.info("String_Node_Str");
    doSomething();
    checkErrors(downloadLink,true,passCode);
    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();
}