Program: 20957
Project: 20957
Buggy source:
@Override public void handlePremium(DownloadLink parameter,Account account) throws Exception {
  boolean free=false;
  STATUS filestatus=null;
synchronized (PREMLOCK) {
    filestatus=getFileStatus(parameter);
    if (filestatus != STATUS.API && filestatus != STATUS.OFFLINE) {
      if (filestatus == STATUS.BLOCKED) {
        login(account,false);
      }
 else {
        login(account,true);
      }
    }
    boolean check=filestatus == STATUS.BLOCKED && !(filestatus == STATUS.API || filestatus == STATUS.OFFLINE);
    if (!isPremium(account,br.cloneBrowser(),check)) {
      simultanpremium=1;
      free=true;
    }
 else {
      if (simultanpremium + 1 > 20) {
        simultanpremium=20;
      }
 else {
        simultanpremium++;
      }
    }
  }
switch (filestatus) {
case API:
    handleAPIDownload(parameter,account);
  return;
case OFFLINE:
try {
  logger.finest(br.getRequest().getHttpConnection() + "String_Node_Str");
}
 catch (Exception e) {
  JDLogger.exception(e);
}
logger.info("String_Node_Str" + br.toString());
throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
case BLOCKED:
if (free) {
if (wait != null) {
throw new PluginException(LinkStatus.ERROR_IP_BLOCKED,Integer.parseInt(wait.trim()) * 60 * 1000l);
}
 else throw new PluginException(LinkStatus.ERROR_IP_BLOCKED,25 * 60 * 1000l);
}
break;
case ONLINE:
if (free) {
handleWebsiteDownload(parameter,account);
return;
}
break;
}
String url=null;
br.setFollowRedirects(false);
br.getPage("String_Node_Str" + wwwWorkaround + "String_Node_Str"+ getDownloadID(parameter));
if (br.containsHTML("String_Node_Str")) throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
if (br.getRedirectLocation() == null) {
String red=br.getRegex("String_Node_Str").getMatch(0);
if (red != null || br.containsHTML("String_Node_Str")) {
if (!isPremium(account,br.cloneBrowser(),true)) {
logger.info("String_Node_Str");
parameter.getLinkStatus().setRetryCount(parameter.getLinkStatus().getRetryCount() + 1);
throw new PluginException(LinkStatus.ERROR_RETRY);
}
 else {
throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
}
}
Form form=br.getForm(0);
if (form != null && form.containsHTML("String_Node_Str")) form=br.getForm(1);
if (form != null && form.containsHTML("String_Node_Str")) {
String passCode;
if (parameter.getStringProperty("String_Node_Str",null) == null) {
passCode=Plugin.getUserInput("String_Node_Str",parameter);
}
 else {
passCode=parameter.getStringProperty("String_Node_Str",null);
}
form.put("String_Node_Str",passCode);
br.submitForm(form);
form=br.getForm(0);
if (form != null && form.containsHTML("String_Node_Str")) form=br.getForm(1);
if (form != null && form.containsHTML("String_Node_Str")) {
parameter.setProperty("String_Node_Str",null);
throw new PluginException(LinkStatus.ERROR_FATAL,JDL.L("String_Node_Str","String_Node_Str"));
}
 else {
parameter.setProperty("String_Node_Str",passCode);
}
}
if (form != null && form.containsHTML("String_Node_Str")) {
if (!isPremium(account,br.cloneBrowser(),true)) {
logger.info("String_Node_Str");
parameter.getLinkStatus().setRetryCount(parameter.getLinkStatus().getRetryCount() + 1);
throw new PluginException(LinkStatus.ERROR_RETRY);
}
 else {
throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
}
}
url=br.getRegex("String_Node_Str").getMatch(0);
if (url == null) url=br.getRedirectLocation();
}
 else {
url=br.getRedirectLocation();
}
doDownload(parameter,url,true,account);
}

Fixed version (ground truth):
@Override public void handlePremium(DownloadLink parameter,Account account) throws Exception {
  boolean free=false;
  STATUS filestatus=null;
synchronized (PREMLOCK) {
    filestatus=getFileStatus(parameter);
    if (filestatus != STATUS.API && filestatus != STATUS.OFFLINE) {
      if (filestatus == STATUS.BLOCKED) {
        login(account,false);
      }
 else {
        login(account,true);
      }
    }
    boolean check=filestatus == STATUS.BLOCKED && !(filestatus == STATUS.API || filestatus == STATUS.OFFLINE);
    if (!isPremium(account,br.cloneBrowser(),check)) {
      simultanpremium=1;
      free=true;
    }
 else {
      if (simultanpremium + 1 > 20) {
        simultanpremium=20;
      }
 else {
        simultanpremium++;
      }
    }
  }
switch (filestatus) {
case API:
    handleAPIDownload(parameter,account);
  return;
case OFFLINE:
try {
  logger.finest(br.getRequest().getHttpConnection() + "String_Node_Str");
}
 catch (Exception e) {
  JDLogger.exception(e);
}
logger.info("String_Node_Str" + br.toString());
throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
case BLOCKED:
if (free) {
if (wait != null) {
throw new PluginException(LinkStatus.ERROR_IP_BLOCKED,Integer.parseInt(wait.trim()) * 60 * 1000l);
}
 else throw new PluginException(LinkStatus.ERROR_IP_BLOCKED,25 * 60 * 1000l);
}
break;
case ONLINE:
if (free) {
handleWebsiteDownload(parameter,account);
return;
}
break;
}
String url=null;
br.setFollowRedirects(false);
br.getPage("String_Node_Str" + wwwWorkaround + "String_Node_Str"+ getDownloadID(parameter));
if (br.containsHTML("String_Node_Str")) throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
if (br.getRedirectLocation() == null) {
String red=br.getRegex("String_Node_Str").getMatch(0);
if (red != null || br.containsHTML("String_Node_Str")) {
if (!isPremium(account,br.cloneBrowser(),true)) {
logger.info("String_Node_Str");
parameter.getLinkStatus().setRetryCount(parameter.getLinkStatus().getRetryCount() + 1);
throw new PluginException(LinkStatus.ERROR_RETRY);
}
 else {
throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
}
}
Form form=br.getForm(0);
if (form != null && form.containsHTML("String_Node_Str")) form=br.getForm(1);
if (form != null && form.containsHTML("String_Node_Str")) {
String passCode;
if (parameter.getStringProperty("String_Node_Str",null) == null) {
passCode=Plugin.getUserInput("String_Node_Str",parameter);
}
 else {
passCode=parameter.getStringProperty("String_Node_Str",null);
}
form.put("String_Node_Str",passCode);
br.submitForm(form);
form=br.getForm(0);
if (form != null && form.containsHTML("String_Node_Str")) form=br.getForm(1);
if (form != null && form.containsHTML("String_Node_Str")) {
parameter.setProperty("String_Node_Str",null);
throw new PluginException(LinkStatus.ERROR_FATAL,JDL.L("String_Node_Str","String_Node_Str"));
}
 else {
parameter.setProperty("String_Node_Str",passCode);
}
}
if (form != null && form.containsHTML("String_Node_Str")) {
if (!isPremium(account,br.cloneBrowser(),true)) {
logger.info("String_Node_Str");
parameter.getLinkStatus().setRetryCount(parameter.getLinkStatus().getRetryCount() + 1);
throw new PluginException(LinkStatus.ERROR_RETRY);
}
 else {
throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
}
}
if (br.containsHTML("String_Node_Str")) {
br.getPage("String_Node_Str");
wait=br.getRegex("String_Node_Str").getMatch(0);
logger.info("String_Node_Str" + wait + "String_Node_Str");
if (wait != null) {
throw new PluginException(LinkStatus.ERROR_IP_BLOCKED,Integer.parseInt(wait.trim()) * 60 * 1000l);
}
 else throw new PluginException(LinkStatus.ERROR_IP_BLOCKED,25 * 60 * 1000l);
}
url=br.getRegex("String_Node_Str").getMatch(0);
if (url == null) url=br.getRedirectLocation();
}
 else {
url=br.getRedirectLocation();
}
doDownload(parameter,url,true,account);
}