Program: 20808
Project: 20808
Buggy source:
public void doFree(DownloadLink downloadLink) throws Exception, PluginException {
  boolean resumable=true;
  int maxchunks=0;
  Form freeform=null;
  Form[] allForms=br.getForms();
  if (allForms == null || allForms.length == 0)   throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
  for (  Form singleForm : allForms) {
    if (singleForm.containsHTML("String_Node_Str")) {
      freeform=singleForm;
      break;
    }
  }
  if (freeform != null) {
    freeform.remove(null);
    freeform.remove("String_Node_Str");
    freeform.put("String_Node_Str","String_Node_Str");
    br.submitForm(freeform);
  }
  checkErrors(downloadLink);
  String md5hash=br.getRegex("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);
  DLForm.remove(null);
  DLForm.remove("String_Node_Str");
  String ttt=br.getRegex("String_Node_Str").getMatch(0);
  if (ttt == null)   ttt=br.getRegex("String_Node_Str").getMatch(0);
  if (ttt != null) {
    logger.info("String_Node_Str" + ttt.trim() + "String_Node_Str");
    int tt=Integer.parseInt(ttt);
    sleep(tt * 1001,downloadLink);
  }
  String passCode=null;
  boolean password=false;
  boolean recaptcha=false;
  if (br.containsHTML("String_Node_Str")) {
    password=true;
    logger.info("String_Node_Str");
  }
  if (br.containsHTML("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 (br.containsHTML("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 (br.containsHTML("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 == true) {
      if (downloadLink.getStringProperty("String_Node_Str",null) == null) {
        passCode=getUserInput(null,downloadLink);
      }
 else {
        passCode=downloadLink.getStringProperty("String_Node_Str",null);
      }
      rc.getForm().put("String_Node_Str",passCode);
      logger.info("String_Node_Str" + passCode + "String_Node_Str");
      password=false;
    }
    recaptcha=true;
    rc.setCode(c);
    logger.info("String_Node_Str" + c + "String_Node_Str");
  }
  if (recaptcha == false) {
    if (password == true) {
      if (downloadLink.getStringProperty("String_Node_Str",null) == null) {
        passCode=getUserInput(null,downloadLink);
      }
 else {
        passCode=downloadLink.getStringProperty("String_Node_Str",null);
      }
      DLForm.put("String_Node_Str",passCode);
      logger.info("String_Node_Str" + passCode + "String_Node_Str");
    }
    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 (br.getRedirectLocation() != null || error == true) {
    br.followConnection();
    logger.info("String_Node_Str");
    String dllink=br.getRedirectLocation();
    if (dllink == null) {
      checkErrors(downloadLink);
      if (br.containsHTML("String_Node_Str"))       throw new PluginException(LinkStatus.ERROR_IP_BLOCKED,null,10 * 60 * 1001l);
      if (br.containsHTML("String_Node_Str")) {
        logger.warning("String_Node_Str" + passCode + "String_Node_Str");
        downloadLink.setProperty("String_Node_Str",null);
        throw new PluginException(LinkStatus.ERROR_RETRY);
      }
      if (br.containsHTML("String_Node_Str")) {
        logger.warning("String_Node_Str");
        throw new PluginException(LinkStatus.ERROR_CAPTCHA);
      }
      if (dllink == null) {
        dllink=br.getRegex("String_Node_Str").getMatch(0);
        if (dllink == null) {
          dllink=br.getRegex("String_Node_Str").getMatch(0);
          if (dllink == null) {
            dllink=br.getRegex("String_Node_Str").getMatch(0);
            if (dllink == null) {
              dllink=br.getRegex("String_Node_Str").getMatch(0);
              if (dllink == null)               dllink=br.getRegex("String_Node_Str").getMatch(0);
            }
          }
        }
      }
    }
    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 (passCode != null) {
    downloadLink.setProperty("String_Node_Str",passCode);
  }
  boolean error2=false;
  try {
    if (dl.getConnection().getContentType().contains("String_Node_Str")) {
      error2=true;
    }
  }
 catch (  Exception e) {
    error2=true;
  }
  if (error2 == true) {
    logger.warning("String_Node_Str");
    br.followConnection();
    checkServerErrors();
    throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
  }
  dl.startDownload();
}

Fixed version (ground truth):
public void doFree(DownloadLink downloadLink) throws Exception, PluginException {
  boolean resumable=true;
  int maxchunks=0;
  Form freeform=null;
  Form[] allForms=br.getForms();
  if (allForms == null || allForms.length == 0)   throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
  for (  Form singleForm : allForms) {
    if (singleForm.containsHTML("String_Node_Str")) {
      freeform=singleForm;
      break;
    }
  }
  if (freeform != null) {
    freeform.remove(null);
    freeform.remove("String_Node_Str");
    freeform.put("String_Node_Str","String_Node_Str");
    br.submitForm(freeform);
  }
  checkErrors(downloadLink);
  String md5hash=br.getRegex("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);
  DLForm.remove(null);
  DLForm.remove("String_Node_Str");
  String ttt=br.getRegex("String_Node_Str").getMatch(0);
  if (ttt == null)   ttt=br.getRegex("String_Node_Str").getMatch(0);
  if (ttt != null) {
    logger.info("String_Node_Str" + ttt.trim() + "String_Node_Str");
    int tt=Integer.parseInt(ttt);
    sleep(tt * 1001,downloadLink);
  }
  String passCode=null;
  boolean password=false;
  boolean recaptcha=false;
  if (br.containsHTML("String_Node_Str")) {
    password=true;
    logger.info("String_Node_Str");
  }
  if (br.containsHTML("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 (br.containsHTML("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 (br.containsHTML("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 == true) {
      if (downloadLink.getStringProperty("String_Node_Str",null) == null) {
        passCode=getUserInput(null,downloadLink);
      }
 else {
        passCode=downloadLink.getStringProperty("String_Node_Str",null);
      }
      rc.getForm().put("String_Node_Str",passCode);
      logger.info("String_Node_Str" + passCode + "String_Node_Str");
      password=false;
    }
    recaptcha=true;
    rc.setCode(c);
    logger.info("String_Node_Str" + c + "String_Node_Str");
  }
  if (recaptcha == false) {
    if (password == true) {
      if (downloadLink.getStringProperty("String_Node_Str",null) == null) {
        passCode=getUserInput(null,downloadLink);
      }
 else {
        passCode=downloadLink.getStringProperty("String_Node_Str",null);
      }
      DLForm.put("String_Node_Str",passCode);
      logger.info("String_Node_Str" + passCode + "String_Node_Str");
    }
    jd.plugins.BrowserAdapter.openDownload(br,downloadLink,DLForm,resumable,maxchunks);
    logger.info("String_Node_Str");
  }
  if (!(dl.getConnection().isContentDisposition())) {
    br.followConnection();
    logger.info("String_Node_Str");
    String dllink=br.getRedirectLocation();
    if (dllink == null) {
      checkErrors(downloadLink);
      if (br.containsHTML("String_Node_Str"))       throw new PluginException(LinkStatus.ERROR_IP_BLOCKED,null,10 * 60 * 1001l);
      if (br.containsHTML("String_Node_Str")) {
        logger.warning("String_Node_Str" + passCode + "String_Node_Str");
        downloadLink.setProperty("String_Node_Str",null);
        throw new PluginException(LinkStatus.ERROR_RETRY);
      }
      if (br.containsHTML("String_Node_Str")) {
        logger.warning("String_Node_Str");
        throw new PluginException(LinkStatus.ERROR_CAPTCHA);
      }
      if (dllink == null) {
        dllink=br.getRegex("String_Node_Str").getMatch(0);
        if (dllink == null) {
          dllink=br.getRegex("String_Node_Str").getMatch(0);
          if (dllink == null) {
            dllink=br.getRegex("String_Node_Str").getMatch(0);
            if (dllink == null) {
              dllink=br.getRegex("String_Node_Str").getMatch(0);
              if (dllink == null)               dllink=br.getRegex("String_Node_Str").getMatch(0);
            }
          }
        }
      }
    }
    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 (passCode != null) {
    downloadLink.setProperty("String_Node_Str",passCode);
  }
  boolean error2=false;
  try {
    if (dl.getConnection().getContentType().contains("String_Node_Str")) {
      error2=true;
    }
  }
 catch (  Exception e) {
    error2=true;
  }
  if (error2 == true) {
    logger.warning("String_Node_Str");
    br.followConnection();
    checkServerErrors();
    throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
  }
  dl.startDownload();
}