Program: 21189
Project: 21189
Buggy source:
private void actionPerformedOnMenuItem(ActionEvent e,MenuItem source){
  SubConfiguration cfg=this.getPluginConfig();
  DownloadLink link;
switch (source.getActionID()) {
case 1:
    cfg.setProperty("String_Node_Str",!cfg.getBooleanProperty("String_Node_Str",true));
  cfg.save();
break;
case 21:
JDFileChooser fc=new JDFileChooser("String_Node_Str");
fc.setMultiSelectionEnabled(true);
FileFilter ff=new FileFilter(){
public boolean accept(File pathname){
if (pathname.getName().matches("String_Node_Str")) return true;
if (!pathname.getName().matches("String_Node_Str") && pathname.getName().matches("String_Node_Str")) {
return true;
}
if (pathname.isDirectory()) return true;
return false;
}
@Override public String getDescription(){
return JDLocale.L("String_Node_Str","String_Node_Str");
}
}
;
fc.setFileFilter(ff);
if (fc.showOpenDialog(SimpleGUI.CURRENTGUI.getFrame()) == JDFileChooser.APPROVE_OPTION) {
File[] list=fc.getSelectedFiles();
if (list == null) return;
for (File archiveStartFile : list) {
link=JDUtilities.getController().getDownloadLinkByFileOutput(archiveStartFile);
if (link == null) {
link=new DownloadLink(null,archiveStartFile.getName(),DUMMY_HOSTER,"String_Node_Str",true);
link.setDownloadSize(archiveStartFile.length());
FilePackage fp=new FilePackage();
fp.setDownloadDirectory(archiveStartFile.getParent());
link.setFilePackage(fp);
}
link=this.findStartLink(link);
if (link == null) {
continue;
}
final DownloadLink finalLink=link;
System.out.print("String_Node_Str" + archiveStartFile);
new Thread(){
public void run(){
addToQueue(finalLink);
}
}
.start();
}
}
break;
case 4:
SimpleGUI.showConfigDialog(SimpleGUI.CURRENTGUI.getFrame(),config);
break;
case 5:
SimpleGUI.showConfigDialog(SimpleGUI.CURRENTGUI.getFrame(),passwordConfig);
break;
case 1000:
link=this.findStartLink((DownloadLink)source.getProperty("String_Node_Str"));
if (link == null) {
return;
}
final DownloadLink finalLink=link;
System.out.print("String_Node_Str" + link);
new Thread(){
public void run(){
addToQueue(finalLink);
}
}
.start();
break;
case 1001:
FilePackage fp=(FilePackage)source.getProperty("String_Node_Str");
ArrayList<DownloadLink> links=new ArrayList<DownloadLink>();
for (DownloadLink l : fp.getDownloadLinks()) {
if (l.getLinkStatus().hasStatus(LinkStatus.FINISHED)) {
if (l.getName().matches("String_Node_Str") || (!l.getName().matches("String_Node_Str") && l.getName().matches("String_Node_Str"))) {
links.add(l);
}
}
}
if (links.size() <= 0) return;
for (DownloadLink link0 : links) {
link=link0;
link=this.findStartLink(link);
if (link == null) {
continue;
}
final DownloadLink finalLink0=link;
System.out.print("String_Node_Str" + link);
new Thread(){
public void run(){
addToQueue(finalLink0);
}
}
.start();
}
break;
case 1002:
link=(DownloadLink)source.getProperty("String_Node_Str");
if (link == null) {
return;
}
String path=link.getStringProperty(JDUnrarConstants.DOWNLOADLINK_KEY_EXTRACTEDPATH);
JDUtilities.openExplorer(new File(path));
break;
case 1003:
link=(DownloadLink)source.getProperty("String_Node_Str");
ArrayList<DownloadLink> list=this.getArchiveList(link);
fc=new JDFileChooser("String_Node_Str");
fc.setMultiSelectionEnabled(false);
fc.setFileSelectionMode(JDFileChooser.DIRECTORIES_ONLY);
ff=new FileFilter(){
public boolean accept(File pathname){
if (pathname.isDirectory()) return true;
return false;
}
@Override public String getDescription(){
return JDLocale.L("String_Node_Str","String_Node_Str");
}
}
;
fc.setFileFilter(ff);
File extractto=this.getExtractToPath(link);
while (extractto != null && !extractto.isDirectory()) extractto=extractto.getParentFile();
fc.setCurrentDirectory(extractto);
if (fc.showOpenDialog(SimpleGUI.CURRENTGUI.getFrame()) == JDFileChooser.APPROVE_OPTION) {
File dl=fc.getSelectedFile();
if (dl == null) {
return;
}
for (DownloadLink l : list) {
l.setProperty(JDUnrarConstants.DOWNLOADLINK_KEY_EXTRACTTOPATH,dl);
}
}
break;
}
}

Fixed version (ground truth):
private void actionPerformedOnMenuItem(ActionEvent e,MenuItem source){
  SubConfiguration cfg=this.getPluginConfig();
  DownloadLink link;
switch (source.getActionID()) {
case 1:
    cfg.setProperty("String_Node_Str",!cfg.getBooleanProperty("String_Node_Str",true));
  cfg.save();
break;
case 21:
JDFileChooser fc=new JDFileChooser("String_Node_Str");
fc.setMultiSelectionEnabled(true);
FileFilter ff=new FileFilter(){
public boolean accept(File pathname){
if (pathname.getName().matches("String_Node_Str")) return true;
if (!pathname.getName().matches("String_Node_Str") && pathname.getName().matches("String_Node_Str")) {
return true;
}
if (pathname.isDirectory()) return true;
return false;
}
@Override public String getDescription(){
return JDLocale.L("String_Node_Str","String_Node_Str");
}
}
;
fc.setFileFilter(ff);
if (fc.showOpenDialog(SimpleGUI.CURRENTGUI.getFrame()) == JDFileChooser.APPROVE_OPTION) {
File[] list=fc.getSelectedFiles();
if (list == null) return;
for (File archiveStartFile : list) {
link=JDUtilities.getController().getDownloadLinkByFileOutput(archiveStartFile);
if (link == null) {
link=new DownloadLink(null,archiveStartFile.getName(),DUMMY_HOSTER,"String_Node_Str",true);
link.setDownloadSize(archiveStartFile.length());
FilePackage fp=new FilePackage();
fp.setDownloadDirectory(archiveStartFile.getParent());
link.setFilePackage(fp);
}
link=this.findStartLink(link);
if (link == null) {
continue;
}
final DownloadLink finalLink=link;
System.out.print("String_Node_Str" + archiveStartFile);
new Thread(){
public void run(){
addToQueue(finalLink);
}
}
.start();
}
}
break;
case 4:
SimpleGUI.showConfigDialog(SimpleGUI.CURRENTGUI.getFrame(),config);
break;
case 5:
SimpleGUI.showConfigDialog(SimpleGUI.CURRENTGUI.getFrame(),passwordConfig);
break;
case 1000:
link=this.findStartLink((DownloadLink)source.getProperty("String_Node_Str"));
if (link == null) {
return;
}
final DownloadLink finalLink=link;
System.out.print("String_Node_Str" + link);
new Thread(){
public void run(){
addToQueue(finalLink);
}
}
.start();
break;
case 1001:
FilePackage fp=(FilePackage)source.getProperty("String_Node_Str");
ArrayList<DownloadLink> links=new ArrayList<DownloadLink>();
for (DownloadLink l : fp.getDownloadLinks()) {
if (l.getLinkStatus().hasStatus(LinkStatus.FINISHED)) {
if (l.getName().matches("String_Node_Str") || (!l.getName().matches("String_Node_Str") && l.getName().matches("String_Node_Str"))) {
links.add(l);
}
}
}
if (links.size() <= 0) return;
for (DownloadLink link0 : links) {
link=link0;
link=this.findStartLink(link);
if (link == null) {
continue;
}
final DownloadLink finalLink0=link;
System.out.print("String_Node_Str" + link);
new Thread(){
public void run(){
addToQueue(finalLink0);
}
}
.start();
}
break;
case 1002:
link=(DownloadLink)source.getProperty("String_Node_Str");
if (link == null) {
return;
}
String path=link.getStringProperty(JDUnrarConstants.DOWNLOADLINK_KEY_EXTRACTEDPATH + "String_Node_Str");
if (!new File(path).exists()) {
JDUtilities.getGUI().showMessageDialog(JDLocale.LF("String_Node_Str","String_Node_Str",path));
}
 else {
JDUtilities.openExplorer(new File(path));
}
break;
case 1003:
link=(DownloadLink)source.getProperty("String_Node_Str");
ArrayList<DownloadLink> list=this.getArchiveList(link);
fc=new JDFileChooser("String_Node_Str");
fc.setMultiSelectionEnabled(false);
fc.setFileSelectionMode(JDFileChooser.DIRECTORIES_ONLY);
ff=new FileFilter(){
public boolean accept(File pathname){
if (pathname.isDirectory()) return true;
return false;
}
@Override public String getDescription(){
return JDLocale.L("String_Node_Str","String_Node_Str");
}
}
;
fc.setFileFilter(ff);
File extractto=this.getExtractToPath(link);
while (extractto != null && !extractto.isDirectory()) extractto=extractto.getParentFile();
fc.setCurrentDirectory(extractto);
if (fc.showOpenDialog(SimpleGUI.CURRENTGUI.getFrame()) == JDFileChooser.APPROVE_OPTION) {
File dl=fc.getSelectedFile();
if (dl == null) {
return;
}
for (DownloadLink l : list) {
l.setProperty(JDUnrarConstants.DOWNLOADLINK_KEY_EXTRACTTOPATH,dl);
}
}
break;
case 1005:
link=(DownloadLink)source.getProperty("String_Node_Str");
if (link == null) {
return;
}
link.getFilePackage().setExtractAfterDownload(!link.getFilePackage().isExtractAfterDownload());
break;
case 1006:
fp=(FilePackage)source.getProperty("String_Node_Str");
if (fp == null) {
return;
}
fp.setExtractAfterDownload(!fp.isExtractAfterDownload());
break;
}
}