Program: 21408
Project: 21408
Buggy source:
public void run(){
  PluginForHost plugin;
  logger.info("String_Node_Str" + downloadLink.getName());
  currentPlugin=plugin=(PluginForHost)downloadLink.getPlugin();
  plugin.resetPlugin();
  downloadLink.setStatusText("String_Node_Str");
  downloadLink.setInProgress(true);
  fireControlEvent(new ControlEvent(this,ControlEvent.CONTROL_SINGLE_DOWNLOAD_CHANGED,downloadLink));
  plugin.init();
  PluginStep step=plugin.doNextStep(downloadLink);
  fireControlEvent(new ControlEvent(this,ControlEvent.CONTROL_PLUGIN_HOST_ACTIVE,plugin));
  fireControlEvent(new ControlEvent(this,ControlEvent.CONTROL_SINGLE_DOWNLOAD_STARTS,downloadLink));
  while (!aborted && step != null && step.getStatus() != PluginStep.STATUS_ERROR) {
    logger.info("String_Node_Str" + step);
    downloadLink.setStatusText("String_Node_Str");
    if (step.getStatus() != PluginStep.STATUS_SKIP) {
switch (step.getStep()) {
case PluginStep.STEP_PENDING:
        long wait=(Long)step.getParameter();
      logger.info("String_Node_Str" + wait);
    while (wait > 0 && !aborted) {
      downloadLink.setStatusText("String_Node_Str" + JDUtilities.formatSeconds((int)(wait / 1000)));
      fireControlEvent(new ControlEvent(this,ControlEvent.CONTROL_SINGLE_DOWNLOAD_CHANGED,downloadLink));
      try {
        Thread.sleep(1000);
      }
 catch (      InterruptedException e) {
      }
      wait-=1000;
    }
  break;
case PluginStep.STEP_GET_CAPTCHA_FILE:
downloadLink.setStatusText("String_Node_Str");
fireControlEvent(new ControlEvent(this,ControlEvent.CONTROL_SINGLE_DOWNLOAD_CHANGED,downloadLink));
File captcha=null;
if (step.getParameter() != null && step.getParameter() instanceof File) {
captcha=(File)step.getParameter();
}
if (captcha == null) {
logger.severe("String_Node_Str");
step.setParameter("String_Node_Str");
step.setStatus(PluginStep.STATUS_ERROR);
downloadLink.setStatus(DownloadLink.STATUS_ERROR_CAPTCHA_IMAGEERROR);
break;
}
 else {
fireControlEvent(new ControlEvent(this,ControlEvent.CONTROL_CAPTCHA_LOADED,captcha));
downloadLink.setLatestCaptchaFile(captcha);
if (plugin.doBotCheck(captcha)) {
downloadLink.setStatus(DownloadLink.STATUS_ERROR_BOT_DETECTED);
step.setStatus(PluginStep.STATUS_ERROR);
step.setParameter(null);
break;
}
if (!Interaction.handleInteraction((Interaction.INTERACTION_DOWNLOAD_CAPTCHA),downloadLink,0)) {
String captchaText=JDUtilities.getCaptcha(controller,plugin,captcha);
logger.info("String_Node_Str" + captchaText);
downloadLink.setStatusText("String_Node_Str" + captchaText);
fireControlEvent(new ControlEvent(this,ControlEvent.CONTROL_SINGLE_DOWNLOAD_CHANGED,downloadLink));
step.setParameter(captchaText);
step.setStatus(PluginStep.STATUS_DONE);
}
 else {
Interaction[] interacts=Interaction.getInteractions(Interaction.INTERACTION_DOWNLOAD_CAPTCHA);
if (interacts.length > 0) {
String captchaText=(String)interacts[0].getProperty("String_Node_Str");
if (captchaText == null) {
captchaText=JDUtilities.getCaptcha(controller,plugin,captcha);
}
logger.info("String_Node_Str" + captchaText);
downloadLink.setStatusText("String_Node_Str" + captchaText);
fireControlEvent(new ControlEvent(this,ControlEvent.CONTROL_SINGLE_DOWNLOAD_CHANGED,downloadLink));
step.setParameter(captchaText);
step.setStatus(PluginStep.STATUS_DONE);
}
}
}
break;
}
if (aborted) {
break;
}
}
if (step != null && downloadLink != null && plugin != null && plugin.nextStep(step) != null) {
downloadLink.setStatusText(plugin.nextStep(step).toString());
fireControlEvent(new ControlEvent(this,ControlEvent.CONTROL_SINGLE_DOWNLOAD_CHANGED,downloadLink));
}
if (step.getStatus() == PluginStep.STATUS_ERROR) {
break;
}
step=plugin.doNextStep(downloadLink);
}
if (aborted) {
downloadLink.setStatusText("String_Node_Str");
plugin.abort();
logger.warning("String_Node_Str");
downloadLink.setStatus(DownloadLink.STATUS_TODO);
fireControlEvent(new ControlEvent(this,ControlEvent.CONTROL_SINGLE_DOWNLOAD_CHANGED,downloadLink));
try {
Thread.sleep(1000);
}
 catch (InterruptedException e) {
}
downloadLink.setInProgress(false);
fireControlEvent(new ControlEvent(this,ControlEvent.CONTROL_PLUGIN_HOST_INACTIVE,plugin));
return;
}
if (step != null && step.getStatus() == PluginStep.STATUS_ERROR) {
switch (downloadLink.getStatus()) {
case DownloadLink.STATUS_ERROR_DOWNLOAD_LIMIT:
this.onErrorWaittime(downloadLink,plugin,step);
break;
case DownloadLink.STATUS_ERROR_STATIC_WAITTIME:
this.onErrorStaticWaittime(downloadLink,plugin,step);
break;
case DownloadLink.STATUS_ERROR_TEMPORARILY_UNAVAILABLE:
this.onErrorTemporarilyUnavailable(downloadLink,plugin,step);
break;
case DownloadLink.STATUS_ERROR_TO_MANY_USERS:
this.onErrorToManyUsers(downloadLink,plugin,step);
break;
case DownloadLink.STATUS_ERROR_CAPTCHA_IMAGEERROR:
this.onErrorCaptchaImage(downloadLink,plugin,step);
break;
case DownloadLink.STATUS_ERROR_FILE_ABUSED:
this.onErrorAbused(downloadLink,plugin,step);
break;
case DownloadLink.STATUS_ERROR_FILE_NOT_UPLOADED:
this.onErrorNotUploaded(downloadLink,plugin,step);
break;
case DownloadLink.STATUS_ERROR_UNKNOWN_RETRY:
this.onErrorRetry(downloadLink,plugin,step);
break;
case DownloadLink.STATUS_ERROR_FILE_NOT_FOUND:
this.onErrorFileNotFound(downloadLink,plugin,step);
break;
case DownloadLink.STATUS_ERROR_CAPTCHA_WRONG:
this.onErrorCaptcha(downloadLink,plugin,step);
break;
case DownloadLink.STATUS_ERROR_PREMIUM:
this.onErrorPremium(downloadLink,plugin,step);
break;
case DownloadLink.STATUS_ERROR_PREMIUM_LOGIN:
this.onErrorPremiumLogin(downloadLink,plugin,step);
break;
case DownloadLink.STATUS_ERROR_NO_FREE_SPACE:
this.onErrorNoFreeSpace(downloadLink,plugin,step);
break;
case DownloadLink.STATUS_ERROR_PLUGIN_SPECIFIC:
this.onErrorPluginSpecific(downloadLink,plugin,step);
break;
case DownloadLink.STATUS_ERROR_BOT_DETECTED:
this.onErrorBotdetection(downloadLink,plugin,step);
break;
default :
logger.info("String_Node_Str" + downloadLink.getStatus());
this.onErrorUnknown(downloadLink,plugin,step);
}
fireControlEvent(new ControlEvent(this,ControlEvent.CONTROL_PLUGIN_HOST_INACTIVE,plugin));
fireControlEvent(new ControlEvent(this,ControlEvent.CONTROL_SINGLE_DOWNLOAD_FINISHED,downloadLink));
}
 else {
downloadLink.setStatusText("String_Node_Str");
downloadLink.setInProgress(false);
fireControlEvent(new ControlEvent(this,ControlEvent.CONTROL_SINGLE_DOWNLOAD_CHANGED,downloadLink));
fireControlEvent(new ControlEvent(this,ControlEvent.CONTROL_PLUGIN_HOST_INACTIVE,plugin));
fireControlEvent(new ControlEvent(this,ControlEvent.CONTROL_SINGLE_DOWNLOAD_FINISHED,downloadLink));
Interaction.handleInteraction((Interaction.INTERACTION_SINGLE_DOWNLOAD_FINISHED),downloadLink);
}
}

Fixed version (ground truth):
public void run(){
  PluginForHost plugin;
  logger.info("String_Node_Str" + downloadLink.getName());
  currentPlugin=plugin=(PluginForHost)downloadLink.getPlugin();
  plugin.resetPlugin();
  downloadLink.setStatusText("String_Node_Str");
  downloadLink.setInProgress(true);
  fireControlEvent(new ControlEvent(this,ControlEvent.CONTROL_SINGLE_DOWNLOAD_CHANGED,downloadLink));
  plugin.init();
  PluginStep step=plugin.doNextStep(downloadLink);
  fireControlEvent(new ControlEvent(this,ControlEvent.CONTROL_PLUGIN_HOST_ACTIVE,plugin));
  fireControlEvent(new ControlEvent(this,ControlEvent.CONTROL_SINGLE_DOWNLOAD_STARTS,downloadLink));
  while (!aborted && step != null && step.getStatus() != PluginStep.STATUS_ERROR) {
    downloadLink.setStatusText("String_Node_Str");
    if (step.getStatus() != PluginStep.STATUS_SKIP) {
switch (step.getStep()) {
case PluginStep.STEP_PENDING:
        long wait=(Long)step.getParameter();
      logger.info("String_Node_Str" + wait);
    while (wait > 0 && !aborted) {
      downloadLink.setStatusText("String_Node_Str" + JDUtilities.formatSeconds((int)(wait / 1000)));
      fireControlEvent(new ControlEvent(this,ControlEvent.CONTROL_SINGLE_DOWNLOAD_CHANGED,downloadLink));
      try {
        Thread.sleep(1000);
      }
 catch (      InterruptedException e) {
      }
      wait-=1000;
    }
  break;
case PluginStep.STEP_GET_CAPTCHA_FILE:
downloadLink.setStatusText("String_Node_Str");
fireControlEvent(new ControlEvent(this,ControlEvent.CONTROL_SINGLE_DOWNLOAD_CHANGED,downloadLink));
File captcha=null;
if (step.getParameter() != null && step.getParameter() instanceof File) {
captcha=(File)step.getParameter();
}
if (captcha == null) {
logger.severe("String_Node_Str");
step.setParameter("String_Node_Str");
step.setStatus(PluginStep.STATUS_ERROR);
downloadLink.setStatus(DownloadLink.STATUS_ERROR_CAPTCHA_IMAGEERROR);
break;
}
 else {
fireControlEvent(new ControlEvent(this,ControlEvent.CONTROL_CAPTCHA_LOADED,captcha));
downloadLink.setLatestCaptchaFile(captcha);
if (plugin.doBotCheck(captcha)) {
downloadLink.setStatus(DownloadLink.STATUS_ERROR_BOT_DETECTED);
step.setStatus(PluginStep.STATUS_ERROR);
step.setParameter(null);
break;
}
if (!Interaction.handleInteraction((Interaction.INTERACTION_DOWNLOAD_CAPTCHA),downloadLink,0)) {
String captchaText=JDUtilities.getCaptcha(controller,plugin,captcha);
logger.info("String_Node_Str" + captchaText);
downloadLink.setStatusText("String_Node_Str" + captchaText);
fireControlEvent(new ControlEvent(this,ControlEvent.CONTROL_SINGLE_DOWNLOAD_CHANGED,downloadLink));
step.setParameter(captchaText);
step.setStatus(PluginStep.STATUS_DONE);
}
 else {
Interaction[] interacts=Interaction.getInteractions(Interaction.INTERACTION_DOWNLOAD_CAPTCHA);
if (interacts.length > 0) {
String captchaText=(String)interacts[0].getProperty("String_Node_Str");
if (captchaText == null) {
captchaText=JDUtilities.getCaptcha(controller,plugin,captcha);
}
logger.info("String_Node_Str" + captchaText);
downloadLink.setStatusText("String_Node_Str" + captchaText);
fireControlEvent(new ControlEvent(this,ControlEvent.CONTROL_SINGLE_DOWNLOAD_CHANGED,downloadLink));
step.setParameter(captchaText);
step.setStatus(PluginStep.STATUS_DONE);
}
}
}
break;
}
if (aborted) {
break;
}
}
if (step != null && downloadLink != null && plugin != null && plugin.nextStep(step) != null) {
downloadLink.setStatusText(plugin.nextStep(step).toString());
fireControlEvent(new ControlEvent(this,ControlEvent.CONTROL_SINGLE_DOWNLOAD_CHANGED,downloadLink));
}
if (step.getStatus() == PluginStep.STATUS_ERROR) {
break;
}
step=plugin.doNextStep(downloadLink);
}
if (aborted) {
downloadLink.setStatusText("String_Node_Str");
plugin.abort();
logger.warning("String_Node_Str");
downloadLink.setStatus(DownloadLink.STATUS_TODO);
fireControlEvent(new ControlEvent(this,ControlEvent.CONTROL_SINGLE_DOWNLOAD_CHANGED,downloadLink));
try {
Thread.sleep(1000);
}
 catch (InterruptedException e) {
}
downloadLink.setInProgress(false);
fireControlEvent(new ControlEvent(this,ControlEvent.CONTROL_PLUGIN_HOST_INACTIVE,plugin));
return;
}
if (step != null && step.getStatus() == PluginStep.STATUS_ERROR) {
switch (downloadLink.getStatus()) {
case DownloadLink.STATUS_ERROR_DOWNLOAD_LIMIT:
this.onErrorWaittime(downloadLink,plugin,step);
break;
case DownloadLink.STATUS_ERROR_STATIC_WAITTIME:
this.onErrorStaticWaittime(downloadLink,plugin,step);
break;
case DownloadLink.STATUS_ERROR_TEMPORARILY_UNAVAILABLE:
this.onErrorTemporarilyUnavailable(downloadLink,plugin,step);
break;
case DownloadLink.STATUS_ERROR_TO_MANY_USERS:
this.onErrorToManyUsers(downloadLink,plugin,step);
break;
case DownloadLink.STATUS_ERROR_CAPTCHA_IMAGEERROR:
this.onErrorCaptchaImage(downloadLink,plugin,step);
break;
case DownloadLink.STATUS_ERROR_FILE_ABUSED:
this.onErrorAbused(downloadLink,plugin,step);
break;
case DownloadLink.STATUS_ERROR_FILE_NOT_UPLOADED:
this.onErrorNotUploaded(downloadLink,plugin,step);
break;
case DownloadLink.STATUS_ERROR_UNKNOWN_RETRY:
this.onErrorRetry(downloadLink,plugin,step);
break;
case DownloadLink.STATUS_ERROR_FILE_NOT_FOUND:
this.onErrorFileNotFound(downloadLink,plugin,step);
break;
case DownloadLink.STATUS_ERROR_CAPTCHA_WRONG:
this.onErrorCaptcha(downloadLink,plugin,step);
break;
case DownloadLink.STATUS_ERROR_PREMIUM:
this.onErrorPremium(downloadLink,plugin,step);
break;
case DownloadLink.STATUS_ERROR_PREMIUM_LOGIN:
this.onErrorPremiumLogin(downloadLink,plugin,step);
break;
case DownloadLink.STATUS_ERROR_NO_FREE_SPACE:
this.onErrorNoFreeSpace(downloadLink,plugin,step);
break;
case DownloadLink.STATUS_ERROR_PLUGIN_SPECIFIC:
this.onErrorPluginSpecific(downloadLink,plugin,step);
break;
case DownloadLink.STATUS_ERROR_BOT_DETECTED:
this.onErrorBotdetection(downloadLink,plugin,step);
break;
default :
logger.info("String_Node_Str" + downloadLink.getStatus());
this.onErrorUnknown(downloadLink,plugin,step);
}
fireControlEvent(new ControlEvent(this,ControlEvent.CONTROL_PLUGIN_HOST_INACTIVE,plugin));
fireControlEvent(new ControlEvent(this,ControlEvent.CONTROL_SINGLE_DOWNLOAD_FINISHED,downloadLink));
}
 else {
downloadLink.setStatusText("String_Node_Str");
downloadLink.setInProgress(false);
fireControlEvent(new ControlEvent(this,ControlEvent.CONTROL_SINGLE_DOWNLOAD_CHANGED,downloadLink));
fireControlEvent(new ControlEvent(this,ControlEvent.CONTROL_PLUGIN_HOST_INACTIVE,plugin));
fireControlEvent(new ControlEvent(this,ControlEvent.CONTROL_SINGLE_DOWNLOAD_FINISHED,downloadLink));
Interaction.handleInteraction((Interaction.INTERACTION_SINGLE_DOWNLOAD_FINISHED),downloadLink);
}
}