Program: 168201
Project: 168201
Buggy source:
/** 
 * Adds "Classify" and "Help" buttons on the Naive Bayes Classifier form
 */
private void addButtonsToToolBar(){
  IToolBarManager mgr=form.getToolBarManager();
  mgr.add(new Action(){
    @Override public ImageDescriptor getImageDescriptor(){
      return (NaiveBayesClassifierViewImageRegistry.getImageIconFactory().getImageDescriptor(IMAGE_LRUN_OBJ));
    }
    @Override public String getToolTipText(){
      return "String_Node_Str";
    }
    public void run(){
      ArrayList<String> trainingDataPaths=new ArrayList<String>();
      ArrayList<String> tempTrainingDataPaths=new ArrayList<String>();
      TreeItem trainingDataset=trainingClassPathTree.getItem(0);
      for (      TreeItem ti : trainingDataset.getItems()) {
        tempTrainingDataPaths.add(ti.getData().toString());
      }
      Job job=new Job("String_Node_Str"){
        private boolean isPreprocessEnabled=false;
        private String pp_outputPath=null;
        String classificationInputDir=classifyInputText.getText();
        String classificationOutputDir=classifyOutputText.getText();
        @Override protected IStatus run(        IProgressMonitor monitor){
          NaiveBayesClassifier nbc=new NaiveBayesClassifier();
          Display.getDefault().syncExec(new Runnable(){
            @Override public void run(){
              isPreprocessEnabled=preprocessEnabled.getSelection();
              pp_outputPath=CommonUiActivator.getDefault().getPreferenceStore().getString("String_Node_Str");
              if (pp_outputPath.isEmpty()) {
                form.getMessageManager().addMessage("String_Node_Str","String_Node_Str",null,IMessageProvider.ERROR);
              }
 else {
                form.getMessageManager().removeMessage("String_Node_Str");
              }
            }
          }
);
          if (isPreprocessEnabled) {
            if (pp_outputPath.isEmpty()) {
              return Status.CANCEL_STATUS;
            }
            monitor.subTask("String_Node_Str");
            try {
              preprocessTask=new Preprocess("String_Node_Str");
              for (              String dir : tempTrainingDataPaths) {
                String preprocessedDirPath=preprocessDirectory(dir);
                trainingDataPaths.add(preprocessedDirPath);
              }
              preprocessTask=new Preprocess("String_Node_Str");
              classificationInputDir=preprocessDirectory(classificationInputDir);
            }
 catch (            IOException e) {
              e.printStackTrace();
            }
          }
 else {
            for (            String path : tempTrainingDataPaths) {
              trainingDataPaths.add(path);
            }
          }
          if (canItProceedClassification(trainingDataPaths,classificationInputDir,classificationOutputDir)) {
            long startTime=System.currentTimeMillis();
            monitor.subTask("String_Node_Str");
            try {
              nbc.classify(trainingDataPaths,classificationInputDir,classificationOutputDir,false,false);
            }
 catch (            FileNotFoundException e1) {
              e1.printStackTrace();
            }
catch (            IOException e1) {
              e1.printStackTrace();
            }
catch (            EvalError e1) {
              e1.printStackTrace();
            }
            if (monitor.isCanceled()) {
              return Status.CANCEL_STATUS;
            }
            System.out.println("String_Node_Str");
            monitor.done();
            System.out.println("String_Node_Str" + (System.currentTimeMillis() - startTime) + "String_Node_Str");
            NlputilsFormComposite.updateStatusMessage(getViewSite(),"String_Node_Str",IStatus.OK);
            return Status.OK_STATUS;
          }
          return Status.CANCEL_STATUS;
        }
      }
;
      job.setUser(true);
      job.schedule();
    }
  }
);
  mgr.add(new Action(){
    @Override public ImageDescriptor getImageDescriptor(){
      return (NaiveBayesClassifierViewImageRegistry.getImageIconFactory().getImageDescriptor(IMAGE_HELP_CO));
    }
    @Override public String getToolTipText(){
      return "String_Node_Str";
    }
    public void run(){
    }
  }
);
  form.getToolBarManager().update(true);
}

Fixed version (ground truth):
/** 
 * Adds "Classify" and "Help" buttons on the Naive Bayes Classifier form
 */
private void addButtonsToToolBar(){
  IToolBarManager mgr=form.getToolBarManager();
  mgr.add(new Action(){
    @Override public ImageDescriptor getImageDescriptor(){
      return (NaiveBayesClassifierViewImageRegistry.getImageIconFactory().getImageDescriptor(IMAGE_LRUN_OBJ));
    }
    @Override public String getToolTipText(){
      return "String_Node_Str";
    }
    public void run(){
      ArrayList<String> trainingDataPaths=new ArrayList<String>();
      ArrayList<String> tempTrainingDataPaths=new ArrayList<String>();
      TreeItem trainingDataset=trainingClassPathTree.getItem(0);
      for (      TreeItem ti : trainingDataset.getItems()) {
        tempTrainingDataPaths.add(ti.getData().toString());
      }
      Job job=new Job("String_Node_Str"){
        private boolean isPreprocessEnabled=false;
        private String pp_outputPath=null;
        String classificationInputDir=classifyInputText.getText();
        String classificationOutputDir=classifyOutputText.getText();
        @Override protected IStatus run(        IProgressMonitor monitor){
          NaiveBayesClassifier nbc=new NaiveBayesClassifier();
          Display.getDefault().syncExec(new Runnable(){
            @Override public void run(){
              isPreprocessEnabled=preprocessEnabled.getSelection();
              pp_outputPath=CommonUiActivator.getDefault().getPreferenceStore().getString("String_Node_Str");
              if (pp_outputPath.isEmpty()) {
                form.getMessageManager().addMessage("String_Node_Str","String_Node_Str",null,IMessageProvider.ERROR);
              }
 else {
                form.getMessageManager().removeMessage("String_Node_Str");
              }
              if (!isPreprocessEnabled) {
                form.getMessageManager().removeMessage("String_Node_Str");
              }
            }
          }
);
          if (isPreprocessEnabled) {
            if (pp_outputPath.isEmpty()) {
              return Status.CANCEL_STATUS;
            }
            monitor.subTask("String_Node_Str");
            try {
              preprocessTask=new Preprocess("String_Node_Str");
              for (              String dir : tempTrainingDataPaths) {
                String preprocessedDirPath=preprocessDirectory(dir);
                trainingDataPaths.add(preprocessedDirPath);
              }
              preprocessTask=new Preprocess("String_Node_Str");
              classificationInputDir=preprocessDirectory(classificationInputDir);
            }
 catch (            IOException e) {
              e.printStackTrace();
            }
          }
 else {
            for (            String path : tempTrainingDataPaths) {
              trainingDataPaths.add(path);
            }
          }
          if (canItProceedClassification(trainingDataPaths,classificationInputDir,classificationOutputDir)) {
            long startTime=System.currentTimeMillis();
            monitor.subTask("String_Node_Str");
            try {
              nbc.classify(trainingDataPaths,classificationInputDir,classificationOutputDir,false,false);
            }
 catch (            FileNotFoundException e1) {
              e1.printStackTrace();
            }
catch (            IOException e1) {
              e1.printStackTrace();
            }
catch (            EvalError e1) {
              e1.printStackTrace();
            }
            if (monitor.isCanceled()) {
              return Status.CANCEL_STATUS;
            }
            System.out.println("String_Node_Str");
            monitor.done();
            System.out.println("String_Node_Str" + (System.currentTimeMillis() - startTime) + "String_Node_Str");
            NlputilsFormComposite.updateStatusMessage(getViewSite(),"String_Node_Str",IStatus.OK);
            return Status.OK_STATUS;
          }
          return Status.CANCEL_STATUS;
        }
      }
;
      job.setUser(true);
      job.schedule();
    }
  }
);
  mgr.add(new Action(){
    @Override public ImageDescriptor getImageDescriptor(){
      return (NaiveBayesClassifierViewImageRegistry.getImageIconFactory().getImageDescriptor(IMAGE_HELP_CO));
    }
    @Override public String getToolTipText(){
      return "String_Node_Str";
    }
    public void run(){
    }
  }
);
  form.getToolBarManager().update(true);
}