Program: 21087
Project: 21087
Buggy source:
public void onUnrarEvent(int id,UnrarWrapper wrapper){
  LinkStatus ls=wrapper.getDownloadLink().getLinkStatus();
  if (wrapper.getDownloadLink().getFilePackage() == FilePackage.getDefaultFilePackage() && wrapper.getProgressController() == null) {
    logger.warning("String_Node_Str" + wrapper.getDownloadLink());
    ProgressController progress=new ProgressController(JDL.LF("String_Node_Str","String_Node_Str",wrapper.getDownloadLink().getFileOutput()),100);
    wrapper.setProgressController(progress);
  }
  if (wrapper.getProgressController() != null) {
    onUnrarDummyEvent(id,wrapper);
    return;
  }
switch (id) {
case JDUnrarConstants.INVALID_BINARY:
    logger.severe("String_Node_Str");
  this.getPluginConfig().setProperty(JDUnrarConstants.CONFIG_KEY_UNRARCOMMAND,null);
this.getPluginConfig().setProperty(JDUnrarConstants.UNRAR_HASH,null);
this.getPluginConfig().save();
break;
case JDUnrarConstants.WRAPPER_EXTRACTION_FAILED:
ArrayList<DownloadLink> list=this.getArchiveList(wrapper.getDownloadLink());
for (DownloadLink link : list) {
if (link == null) continue;
LinkStatus lls=link.getLinkStatus();
if (wrapper.getException() != null) {
lls.addStatus(LinkStatus.ERROR_POST_PROCESS);
lls.setErrorMessage("String_Node_Str" + wrapper.getException().getMessage());
link.requestGuiUpdate();
}
 else {
lls.addStatus(LinkStatus.ERROR_POST_PROCESS);
lls.setErrorMessage("String_Node_Str");
link.requestGuiUpdate();
}
}
this.onFinished(wrapper);
break;
case JDUnrarConstants.WRAPPER_PASSWORD_NEEDED_TO_CONTINUE:
wrapper.getDownloadLink().requestGuiUpdate();
if (this.getPluginConfig().getBooleanProperty(JDUnrarConstants.CONFIG_KEY_ASK_UNKNOWN_PASS,true)) {
String pass=JDUtilities.getGUI().showCountdownUserInputDialog(JDL.LF("String_Node_Str","String_Node_Str",wrapper.getDownloadLink().getName()),null);
if (pass == null) {
ls.addStatus(LinkStatus.ERROR_POST_PROCESS);
ls.setStatusText(JDL.L("String_Node_Str","String_Node_Str"));
this.onFinished(wrapper);
break;
}
wrapper.setPassword(pass);
}
break;
case JDUnrarConstants.WRAPPER_CRACK_PASSWORD:
wrapper.getDownloadLink().getLinkStatus().setStatusText(JDL.L("String_Node_Str","String_Node_Str"));
wrapper.getDownloadLink().requestGuiUpdate();
break;
case JDUnrarConstants.WRAPPER_NEW_STATUS:
break;
case JDUnrarConstants.WRAPPER_START_OPEN_ARCHIVE:
wrapper.getDownloadLink().getLinkStatus().setStatusText(JDL.L("String_Node_Str","String_Node_Str"));
wrapper.getDownloadLink().requestGuiUpdate();
break;
case JDUnrarConstants.WRAPPER_OPEN_ARCHIVE_SUCCESS:
assignRealDownloadDir(wrapper);
break;
case JDUnrarConstants.WRAPPER_PASSWORD_FOUND:
wrapper.getDownloadLink().getLinkStatus().setStatusText(JDL.L("String_Node_Str","String_Node_Str"));
wrapper.getDownloadLink().requestGuiUpdate();
wrapper.getDownloadLink().setPluginProgress(null);
break;
case JDUnrarConstants.WRAPPER_PASSWORT_CRACKING:
wrapper.getDownloadLink().getLinkStatus().setStatusText(JDL.L("String_Node_Str","String_Node_Str"));
if (wrapper.getDownloadLink().getPluginProgress() == null) {
wrapper.getDownloadLink().setPluginProgress(new PluginProgress(wrapper.getCrackProgress(),100,Color.GREEN.darker()));
}
 else {
wrapper.getDownloadLink().getPluginProgress().setCurrent(wrapper.getCrackProgress());
}
wrapper.getDownloadLink().requestGuiUpdate();
break;
case JDUnrarConstants.WRAPPER_ON_PROGRESS:
wrapper.getDownloadLink().getLinkStatus().setStatusText(JDL.L("String_Node_Str","String_Node_Str"));
if (wrapper.getDownloadLink().getPluginProgress() == null) {
wrapper.getDownloadLink().setPluginProgress(new PluginProgress(wrapper.getExtractedSize(),wrapper.getTotalSize(),Color.YELLOW.darker()));
}
 else {
wrapper.getDownloadLink().getPluginProgress().setCurrent(wrapper.getExtractedSize());
}
wrapper.getDownloadLink().requestGuiUpdate();
break;
case JDUnrarConstants.WRAPPER_START_EXTRACTION:
break;
case JDUnrarConstants.WRAPPER_STARTED:
break;
case JDUnrarConstants.WRAPPER_EXTRACTION_FAILED_CRC:
list=this.getArchiveList(wrapper.getDownloadLink());
list.add(null);
DownloadLink crc=null;
if (wrapper.getCurrentVolume() > 0) {
crc=list.size() >= wrapper.getCurrentVolume() ? list.get(wrapper.getCurrentVolume() - 1) : null;
}
if (crc != null) {
crc.getLinkStatus().removeStatus(LinkStatus.FINISHED);
crc.getLinkStatus().addStatus(LinkStatus.ERROR_DOWNLOAD_FAILED);
crc.getLinkStatus().setValue(LinkStatus.VALUE_FAILED_HASH);
crc.getLinkStatus().setErrorMessage(JDL.LF("String_Node_Str","String_Node_Str",crc.getName()));
crc.requestGuiUpdate();
}
 else {
for (DownloadLink link : list) {
if (link == null) continue;
link.getLinkStatus().setErrorMessage(JDL.L("String_Node_Str","String_Node_Str"));
link.requestGuiUpdate();
}
}
this.onFinished(wrapper);
break;
case JDUnrarConstants.WRAPPER_PROGRESS_SINGLE_FILE_FINISHED:
break;
case JDUnrarConstants.WRAPPER_FINISHED_SUCCESSFULL:
list=this.getArchiveList(wrapper.getDownloadLink());
File[] files=new File[wrapper.getFiles().size()];
int i=0;
for (ArchivFile af : wrapper.getFiles()) {
files[i++]=af.getFile();
}
JDUtilities.getController().fireControlEvent(new ControlEvent(wrapper,ControlEvent.CONTROL_ON_FILEOUTPUT,files));
for (DownloadLink link : list) {
if (link == null) continue;
link.getLinkStatus().addStatus(LinkStatus.FINISHED);
link.getLinkStatus().removeStatus(LinkStatus.ERROR_POST_PROCESS);
link.getLinkStatus().setStatusText(JDL.L("String_Node_Str","String_Node_Str"));
link.requestGuiUpdate();
}
if (this.getPluginConfig().getBooleanProperty(JDUnrarConstants.CONFIG_KEY_REMOVE_INFO_FILE,false)) {
File fileOutput=new File(wrapper.getDownloadLink().getFileOutput());
String packname=wrapper.getDownloadLink().getFilePackage().getName();
File infoFiles=new File(fileOutput.getParentFile(),packname.replaceFirst("String_Node_Str","String_Node_Str") + "String_Node_Str");
if (infoFiles.exists() && infoFiles.delete()) {
logger.info(infoFiles.getName() + "String_Node_Str");
}
}
this.onFinished(wrapper);
break;
default :
}
}

Fixed version (ground truth):
public void onUnrarEvent(int id,UnrarWrapper wrapper){
  LinkStatus ls=wrapper.getDownloadLink().getLinkStatus();
  if (wrapper.getDownloadLink().getFilePackage() == FilePackage.getDefaultFilePackage() && wrapper.getProgressController() == null) {
    logger.warning("String_Node_Str" + wrapper.getDownloadLink());
    ProgressController progress=new ProgressController(JDL.LF("String_Node_Str","String_Node_Str",wrapper.getDownloadLink().getFileOutput()),100);
    wrapper.setProgressController(progress);
  }
  if (wrapper.getProgressController() != null) {
    onUnrarDummyEvent(id,wrapper);
    return;
  }
switch (id) {
case JDUnrarConstants.INVALID_BINARY:
    logger.severe("String_Node_Str");
  this.getPluginConfig().setProperty(JDUnrarConstants.CONFIG_KEY_UNRARCOMMAND,null);
this.getPluginConfig().setProperty(JDUnrarConstants.UNRAR_HASH,null);
this.getPluginConfig().save();
break;
case JDUnrarConstants.WRAPPER_EXTRACTION_FAILED:
ArrayList<DownloadLink> list=this.getArchiveList(wrapper.getDownloadLink());
for (DownloadLink link : list) {
if (link == null) continue;
LinkStatus lls=link.getLinkStatus();
if (wrapper.getException() != null) {
lls.addStatus(LinkStatus.ERROR_POST_PROCESS);
lls.setErrorMessage("String_Node_Str" + wrapper.getException().getMessage());
link.requestGuiUpdate();
}
 else {
lls.addStatus(LinkStatus.ERROR_POST_PROCESS);
lls.setErrorMessage("String_Node_Str");
link.requestGuiUpdate();
}
}
this.onFinished(wrapper);
break;
case JDUnrarConstants.WRAPPER_PASSWORD_NEEDED_TO_CONTINUE:
wrapper.getDownloadLink().requestGuiUpdate();
if (this.getPluginConfig().getBooleanProperty(JDUnrarConstants.CONFIG_KEY_ASK_UNKNOWN_PASS,true)) {
String pass=JDUtilities.getGUI().showCountdownUserInputDialog(JDL.LF("String_Node_Str","String_Node_Str",wrapper.getDownloadLink().getName()),null);
if (pass == null) {
ls.addStatus(LinkStatus.ERROR_POST_PROCESS);
ls.setStatusText(JDL.L("String_Node_Str","String_Node_Str"));
this.onFinished(wrapper);
break;
}
wrapper.setPassword(pass);
}
break;
case JDUnrarConstants.WRAPPER_CRACK_PASSWORD:
wrapper.getDownloadLink().getLinkStatus().setStatusText(JDL.L("String_Node_Str","String_Node_Str"));
wrapper.getDownloadLink().requestGuiUpdate();
break;
case JDUnrarConstants.WRAPPER_NEW_STATUS:
break;
case JDUnrarConstants.WRAPPER_START_OPEN_ARCHIVE:
wrapper.getDownloadLink().getLinkStatus().setStatusText(JDL.L("String_Node_Str","String_Node_Str"));
wrapper.getDownloadLink().requestGuiUpdate();
break;
case JDUnrarConstants.WRAPPER_OPEN_ARCHIVE_SUCCESS:
assignRealDownloadDir(wrapper);
break;
case JDUnrarConstants.WRAPPER_PASSWORD_FOUND:
wrapper.getDownloadLink().getLinkStatus().setStatusText(JDL.L("String_Node_Str","String_Node_Str"));
wrapper.getDownloadLink().requestGuiUpdate();
wrapper.getDownloadLink().setPluginProgress(null);
break;
case JDUnrarConstants.WRAPPER_PASSWORT_CRACKING:
wrapper.getDownloadLink().getLinkStatus().setStatusText(JDL.L("String_Node_Str","String_Node_Str"));
if (wrapper.getDownloadLink().getPluginProgress() == null) {
wrapper.getDownloadLink().setPluginProgress(new PluginProgress(wrapper.getCrackProgress(),100,Color.GREEN.darker()));
}
 else {
wrapper.getDownloadLink().getPluginProgress().setCurrent(wrapper.getCrackProgress());
}
wrapper.getDownloadLink().requestGuiUpdate();
break;
case JDUnrarConstants.WRAPPER_ON_PROGRESS:
wrapper.getDownloadLink().getLinkStatus().setStatusText(JDL.L("String_Node_Str","String_Node_Str"));
if (wrapper.getDownloadLink().getPluginProgress() == null) {
wrapper.getDownloadLink().setPluginProgress(new PluginProgress(wrapper.getExtractedSize(),wrapper.getTotalSize(),Color.YELLOW.darker()));
}
 else {
wrapper.getDownloadLink().getPluginProgress().setCurrent(wrapper.getExtractedSize());
}
wrapper.getDownloadLink().requestGuiUpdate();
break;
case JDUnrarConstants.WRAPPER_START_EXTRACTION:
break;
case JDUnrarConstants.WRAPPER_STARTED:
break;
case JDUnrarConstants.WRAPPER_EXTRACTION_FAILED_CRC:
list=this.getArchiveList(wrapper.getDownloadLink());
try {
if (wrapper.getCurrentFile() != null) {
logger.info("String_Node_Str" + wrapper.getCurrentFile().getFile() + "String_Node_Str");
wrapper.getCurrentFile().getFile().delete();
}
}
 catch (Exception e) {
}
DownloadLink crc=null;
if (wrapper.getCurrentVolume() > 0) {
crc=list.size() >= wrapper.getCurrentVolume() ? list.get(wrapper.getCurrentVolume() - 1) : null;
}
if (crc != null) {
for (DownloadLink link : list) {
if (link == null) {
continue;
}
if (link == crc) {
link.getLinkStatus().removeStatus(LinkStatus.FINISHED);
link.getLinkStatus().removeStatus(LinkStatus.ERROR_ALREADYEXISTS);
link.getLinkStatus().addStatus(LinkStatus.ERROR_DOWNLOAD_FAILED);
link.getLinkStatus().setValue(LinkStatus.VALUE_FAILED_HASH);
link.getLinkStatus().setErrorMessage(JDL.LF("String_Node_Str","String_Node_Str",crc.getName()));
}
 else {
link.getLinkStatus().addStatus(LinkStatus.ERROR_POST_PROCESS);
link.getLinkStatus().setErrorMessage("String_Node_Str");
}
link.requestGuiUpdate();
}
}
 else {
for (DownloadLink link : list) {
if (link == null) continue;
link.getLinkStatus().setErrorMessage(JDL.L("String_Node_Str","String_Node_Str"));
link.requestGuiUpdate();
}
}
this.onFinished(wrapper);
break;
case JDUnrarConstants.WRAPPER_PROGRESS_SINGLE_FILE_FINISHED:
break;
case JDUnrarConstants.WRAPPER_FINISHED_SUCCESSFULL:
list=this.getArchiveList(wrapper.getDownloadLink());
File[] files=new File[wrapper.getFiles().size()];
int i=0;
for (ArchivFile af : wrapper.getFiles()) {
files[i++]=af.getFile();
}
JDUtilities.getController().fireControlEvent(new ControlEvent(wrapper,ControlEvent.CONTROL_ON_FILEOUTPUT,files));
for (DownloadLink link : list) {
if (link == null) continue;
link.getLinkStatus().addStatus(LinkStatus.FINISHED);
link.getLinkStatus().removeStatus(LinkStatus.ERROR_POST_PROCESS);
link.getLinkStatus().setStatusText(JDL.L("String_Node_Str","String_Node_Str"));
link.requestGuiUpdate();
}
if (this.getPluginConfig().getBooleanProperty(JDUnrarConstants.CONFIG_KEY_REMOVE_INFO_FILE,false)) {
File fileOutput=new File(wrapper.getDownloadLink().getFileOutput());
String packname=wrapper.getDownloadLink().getFilePackage().getName();
File infoFiles=new File(fileOutput.getParentFile(),packname.replaceFirst("String_Node_Str","String_Node_Str") + "String_Node_Str");
if (infoFiles.exists() && infoFiles.delete()) {
logger.info(infoFiles.getName() + "String_Node_Str");
}
}
this.onFinished(wrapper);
break;
default :
}
}