Program: 168207
Project: 168207
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(){
      final ArrayList<String> trainingDataPaths=new ArrayList<String>();
      final 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"){
        final String classificationOutputDir=classifyOutputText.getText();
        private String classificationInputDir=classifyInputText.getText();
        private boolean canItProceed=false;
        @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 (isPreprocessEnabled && pp_outputPath.isEmpty()) {
                form.getMessageManager().addMessage("String_Node_Str","String_Node_Str",null,IMessageProvider.ERROR);
                return;
              }
 else {
                form.getMessageManager().removeMessage("String_Node_Str");
              }
              canItProceed=canItProceedClassification(trainingDataPaths,classificationInputDir,classificationOutputDir);
            }
          }
);
          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 (canItProceed) {
            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(){
      NlputilsFormComposite.updateStatusMessage(getViewSite(),null,null);
      final ArrayList<String> trainingDataPaths=new ArrayList<String>();
      final 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"){
        final String classificationOutputDir=classifyOutputText.getText();
        private String classificationInputDir=classifyInputText.getText();
        private boolean canItProceed=false;
        @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 (isPreprocessEnabled && pp_outputPath.isEmpty()) {
                form.getMessageManager().addMessage("String_Node_Str","String_Node_Str",null,IMessageProvider.ERROR);
                return;
              }
 else {
                form.getMessageManager().removeMessage("String_Node_Str");
              }
              canItProceed=canItProceedClassification(tempTrainingDataPaths,classificationInputDir,classificationOutputDir);
            }
          }
);
          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) {
              return handleException(monitor,e,"String_Node_Str");
            }
catch (            Exception e) {
              return handleException(monitor,e,"String_Node_Str");
            }
          }
 else {
            for (            String path : tempTrainingDataPaths) {
              trainingDataPaths.add(path);
            }
          }
          if (canItProceed) {
            long startTime=System.currentTimeMillis();
            monitor.subTask("String_Node_Str");
            try {
              nbc.classify(trainingDataPaths,classificationInputDir,classificationOutputDir,false,false);
            }
 catch (            FileNotFoundException e1) {
              return handleException(monitor,e1,"String_Node_Str");
            }
catch (            IOException e1) {
              return handleException(monitor,e1,"String_Node_Str");
            }
catch (            EvalError e1) {
              return handleException(monitor,e1,"String_Node_Str");
            }
catch (            Exception e) {
              return handleException(monitor,e,"String_Node_Str");
            }
            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);
}