Program: 20814
Project: 20814
Buggy source:
@Override public void handleFree(DownloadLink downloadLink) throws Exception, PluginException {
  boolean resumable=true;
  int maxchunks=0;
  requestFileInformation(downloadLink);
  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)   br.submitForm(freeform);
  if (br.containsHTML("String_Node_Str")) {
    String filesizelimit=br.getRegex("String_Node_Str").getMatch(0);
    if (filesizelimit != null) {
      filesizelimit=filesizelimit.trim();
      logger.warning("String_Node_Str" + filesizelimit + "String_Node_Str");
      throw new PluginException(LinkStatus.ERROR_FATAL,"String_Node_Str" + filesizelimit);
    }
 else {
      logger.warning("String_Node_Str");
      throw new PluginException(LinkStatus.ERROR_FATAL,"String_Node_Str");
    }
  }
  if (br.containsHTML("String_Node_Str")) {
    throw new PluginException(LinkStatus.ERROR_FATAL,"String_Node_Str");
  }
  if (br.containsHTML("String_Node_Str")) {
    int minutes=0, seconds=0, hours=0;
    String tmphrs=br.getRegex("String_Node_Str").getMatch(0);
    if (tmphrs != null)     hours=Integer.parseInt(tmphrs);
    String tmpmin=br.getRegex("String_Node_Str").getMatch(0);
    if (tmpmin != null)     minutes=Integer.parseInt(tmpmin);
    String tmpsec=br.getRegex("String_Node_Str").getMatch(0);
    if (tmpsec != null)     seconds=Integer.parseInt(tmpsec);
    int waittime=((3600 * hours) + (60 * minutes) + seconds+ 1) * 1000;
    logger.info("String_Node_Str" + waittime + "String_Node_Str");
    throw new PluginException(LinkStatus.ERROR_IP_BLOCKED,null,waittime);
  }
  if (br.containsHTML("String_Node_Str")) {
    String tmphrs=br.getRegex("String_Node_Str").getMatch(0);
    String tmpmin=br.getRegex("String_Node_Str").getMatch(0);
    String tmpsec=br.getRegex("String_Node_Str").getMatch(0);
    if (tmphrs == null && tmpmin == null && tmpsec == null) {
      throw new PluginException(LinkStatus.ERROR_IP_BLOCKED,null,60 * 60 * 1000l);
    }
 else {
      int minutes=0, seconds=0, hours=0;
      if (tmphrs != null)       hours=Integer.parseInt(tmphrs);
      if (tmpmin != null)       minutes=Integer.parseInt(tmpmin);
      if (tmpsec != null)       seconds=Integer.parseInt(tmpsec);
      int waittime=((3600 * hours) + (60 * minutes) + seconds+ 1) * 1000;
      logger.info("String_Node_Str" + waittime + "String_Node_Str");
      throw new PluginException(LinkStatus.ERROR_IP_BLOCKED,null,waittime);
    }
  }
  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);
  String 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 captchaurl=br.getRegex("String_Node_Str").getMatch(1);
    if (captchaurl == null)     captchaurl=br.getRegex("String_Node_Str").getMatch(0);
    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") && !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();
    System.out.print(br.toString());
    logger.info("String_Node_Str");
    String dllink=br.getRedirectLocation();
    if (dllink == null) {
      if (br.containsHTML("String_Node_Str")) {
        int minutes=0, seconds=0, hours=0;
        String tmphrs=br.getRegex("String_Node_Str").getMatch(0);
        if (tmphrs != null)         hours=Integer.parseInt(tmphrs);
        String tmpmin=br.getRegex("String_Node_Str").getMatch(0);
        if (tmpmin != null)         minutes=Integer.parseInt(tmpmin);
        String tmpsec=br.getRegex("String_Node_Str").getMatch(0);
        if (tmpsec != null)         seconds=Integer.parseInt(tmpsec);
        int waittime=((3600 * hours) + (60 * minutes) + seconds+ 1) * 1000;
        logger.info("String_Node_Str" + waittime + "String_Node_Str");
        throw new PluginException(LinkStatus.ERROR_IP_BLOCKED,null,waittime);
      }
      if (br.containsHTML("String_Node_Str")) {
        String tmphrs=br.getRegex("String_Node_Str").getMatch(0);
        String tmpmin=br.getRegex("String_Node_Str").getMatch(0);
        String tmpsec=br.getRegex("String_Node_Str").getMatch(0);
        if (tmphrs == null && tmpmin == null && tmpsec == null) {
          throw new PluginException(LinkStatus.ERROR_IP_BLOCKED,null,60 * 60 * 1000l);
        }
 else {
          int minutes=0, seconds=0, hours=0;
          if (tmphrs != null)           hours=Integer.parseInt(tmphrs);
          if (tmpmin != null)           minutes=Integer.parseInt(tmpmin);
          if (tmpsec != null)           seconds=Integer.parseInt(tmpsec);
          int waittime=((3600 * hours) + (60 * minutes) + seconds+ 1) * 1000;
          logger.info("String_Node_Str" + waittime + "String_Node_Str");
          throw new PluginException(LinkStatus.ERROR_IP_BLOCKED,null,waittime);
        }
      }
      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) {
      logger.warning("String_Node_Str");
      throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
    }
    logger.info("String_Node_Str" + dllink + "String_Node_Str");
    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();
    if (br.containsHTML("String_Node_Str")) {
      logger.warning("String_Node_Str");
      throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
    }
    throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
  }
  dl.startDownload();
}

Fixed version (ground truth):
@Override public void handleFree(DownloadLink downloadLink) throws Exception, PluginException {
  boolean resumable=true;
  int maxchunks=0;
  requestFileInformation(downloadLink);
  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)   br.submitForm(freeform);
  if (br.containsHTML("String_Node_Str")) {
    String filesizelimit=br.getRegex("String_Node_Str").getMatch(0);
    if (filesizelimit != null) {
      filesizelimit=filesizelimit.trim();
      logger.warning("String_Node_Str" + filesizelimit + "String_Node_Str");
      throw new PluginException(LinkStatus.ERROR_FATAL,"String_Node_Str" + filesizelimit);
    }
 else {
      logger.warning("String_Node_Str");
      throw new PluginException(LinkStatus.ERROR_FATAL,"String_Node_Str");
    }
  }
  if (br.containsHTML("String_Node_Str")) {
    throw new PluginException(LinkStatus.ERROR_FATAL,"String_Node_Str");
  }
  if (br.containsHTML("String_Node_Str")) {
    int minutes=0, seconds=0, hours=0;
    String tmphrs=br.getRegex("String_Node_Str").getMatch(0);
    if (tmphrs != null)     hours=Integer.parseInt(tmphrs);
    String tmpmin=br.getRegex("String_Node_Str").getMatch(0);
    if (tmpmin != null)     minutes=Integer.parseInt(tmpmin);
    String tmpsec=br.getRegex("String_Node_Str").getMatch(0);
    if (tmpsec != null)     seconds=Integer.parseInt(tmpsec);
    int waittime=((3600 * hours) + (60 * minutes) + seconds+ 1) * 1000;
    logger.info("String_Node_Str" + waittime + "String_Node_Str");
    throw new PluginException(LinkStatus.ERROR_IP_BLOCKED,null,waittime);
  }
  if (br.containsHTML("String_Node_Str")) {
    String tmphrs=br.getRegex("String_Node_Str").getMatch(0);
    String tmpmin=br.getRegex("String_Node_Str").getMatch(0);
    String tmpsec=br.getRegex("String_Node_Str").getMatch(0);
    if (tmphrs == null && tmpmin == null && tmpsec == null) {
      throw new PluginException(LinkStatus.ERROR_IP_BLOCKED,null,60 * 60 * 1000l);
    }
 else {
      int minutes=0, seconds=0, hours=0;
      if (tmphrs != null)       hours=Integer.parseInt(tmphrs);
      if (tmpmin != null)       minutes=Integer.parseInt(tmpmin);
      if (tmpsec != null)       seconds=Integer.parseInt(tmpsec);
      int waittime=((3600 * hours) + (60 * minutes) + seconds+ 1) * 1000;
      logger.info("String_Node_Str" + waittime + "String_Node_Str");
      throw new PluginException(LinkStatus.ERROR_IP_BLOCKED,null,waittime);
    }
  }
  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);
  String 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.getRegex(CPREGEX0).getMatch(1) != null || br.getRegex(CPREGEX1).getMatch(0) != null) {
    logger.info("String_Node_Str");
    String captchaurl=br.getRegex(CPREGEX0).getMatch(1);
    if (captchaurl == null)     captchaurl=br.getRegex(CPREGEX1).getMatch(0);
    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") && !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) {
      if (br.containsHTML("String_Node_Str")) {
        int minutes=0, seconds=0, hours=0;
        String tmphrs=br.getRegex("String_Node_Str").getMatch(0);
        if (tmphrs != null)         hours=Integer.parseInt(tmphrs);
        String tmpmin=br.getRegex("String_Node_Str").getMatch(0);
        if (tmpmin != null)         minutes=Integer.parseInt(tmpmin);
        String tmpsec=br.getRegex("String_Node_Str").getMatch(0);
        if (tmpsec != null)         seconds=Integer.parseInt(tmpsec);
        int waittime=((3600 * hours) + (60 * minutes) + seconds+ 1) * 1000;
        logger.info("String_Node_Str" + waittime + "String_Node_Str");
        throw new PluginException(LinkStatus.ERROR_IP_BLOCKED,null,waittime);
      }
      if (br.containsHTML("String_Node_Str")) {
        String tmphrs=br.getRegex("String_Node_Str").getMatch(0);
        String tmpmin=br.getRegex("String_Node_Str").getMatch(0);
        String tmpsec=br.getRegex("String_Node_Str").getMatch(0);
        if (tmphrs == null && tmpmin == null && tmpsec == null) {
          throw new PluginException(LinkStatus.ERROR_IP_BLOCKED,null,60 * 60 * 1000l);
        }
 else {
          int minutes=0, seconds=0, hours=0;
          if (tmphrs != null)           hours=Integer.parseInt(tmphrs);
          if (tmpmin != null)           minutes=Integer.parseInt(tmpmin);
          if (tmpsec != null)           seconds=Integer.parseInt(tmpsec);
          int waittime=((3600 * hours) + (60 * minutes) + seconds+ 1) * 1000;
          logger.info("String_Node_Str" + waittime + "String_Node_Str");
          throw new PluginException(LinkStatus.ERROR_IP_BLOCKED,null,waittime);
        }
      }
      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) {
      logger.warning("String_Node_Str");
      throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
    }
    logger.info("String_Node_Str" + dllink + "String_Node_Str");
    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();
    if (br.containsHTML("String_Node_Str")) {
      logger.warning("String_Node_Str");
      throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
    }
    throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
  }
  dl.startDownload();
}