Program: 168081
Project: 168081
Buggy source:
private void addButtonsToToolBar(){
  IToolBarManager mgr=form.getToolBarManager();
  mgr.add(new Action(){
    @Override public ImageDescriptor getImageDescriptor(){
      return (AmericanPresidencyCrawlerViewImageRegistry.getImageIconFactory().getImageDescriptor(IMAGE_LRUN_OBJ));
    }
    @Override public String getToolTipText(){
      return "String_Node_Str";
    }
    String month, day, year;
    String outputDir;
    int presidentIndex;
    int documentIndex;
    String corpusName;
    boolean browse;
    boolean canProceed;
    String query1;
    String query2;
    Calendar from=null;
    Calendar to=null;
    String operator;
    @Override public void run(){
      final Job job=new Job("String_Node_Str"){
        @Override protected IStatus run(        IProgressMonitor monitor){
          TacitFormComposite.setConsoleViewInFocus();
          TacitFormComposite.updateStatusMessage(getViewSite(),null,null,form);
          Display.getDefault().syncExec(new Runnable(){
            @Override public void run(){
              browse=dateCheckBrowse.getSelection();
              corpusName=corpusNameTxt.getText();
              if (!browse) {
                if (andButton.getSelection())                 operator="String_Node_Str";
 else                 if (orButton.getSelection())                 operator="String_Node_Str";
 else                 operator="String_Node_Str";
                query1=searchText1.getText();
                query2=searchText2.getText();
                presidentIndex=selectPresidentSearch.getSelectionIndex();
                documentIndex=selectDocumentSearch.getSelectionIndex();
                if (dateCheckSearch.getSelection()) {
                  from=Calendar.getInstance();
                  from.set(fromDate.getYear(),fromDate.getMonth(),fromDate.getDay());
                  to=Calendar.getInstance();
                  to.set(toDate.getYear(),toDate.getMonth(),toDate.getDay());
                }
              }
 else {
                month=browseMonth.getSelectionIndex() == 0 ? "String_Node_Str" : months[browseMonth.getSelectionIndex()];
                day=browseDay.getSelectionIndex() == 0 ? "String_Node_Str" : days[browseDay.getSelectionIndex()];
                year=browseYear.getSelectionIndex() == 0 ? "String_Node_Str" : years[browseYear.getSelectionIndex()];
                documentIndex=selectDocumentSearch.getSelectionIndex();
                presidentIndex=selectPresidentSearch.getSelectionIndex();
              }
              Date dateObj=new Date();
              corpusName+="String_Node_Str" + dateObj.getTime();
              outputDir=IAmericanPresidencyCrawlerViewConstants.DEFAULT_CORPUS_LOCATION + File.separator + corpusName;
              if (!new File(outputDir).exists()) {
                new File(outputDir).mkdirs();
              }
            }
          }
);
          int progressSize=1000;
          monitor.beginTask("String_Node_Str",progressSize);
          TacitFormComposite.writeConsoleHeaderBegining("String_Node_Str");
          final AmericanPresidencyCrawler rc=new AmericanPresidencyCrawler();
          monitor.subTask("String_Node_Str");
          monitor.worked(10);
          if (monitor.isCanceled())           handledCancelRequest("String_Node_Str");
          americanPresidencyCorpus=new Corpus(corpusName,CMDataType.PRESIDENCY_JSON);
          if (!browse) {
            try {
              monitor.subTask("String_Node_Str");
              if (monitor.isCanceled())               return handledCancelRequest("String_Node_Str");
              rc.crawlSearch(outputDir,query1,query2,operator,from,to,presidentNameMap.get(presidentIndex),documentCategoryMap.get(documentIndex),monitor);
              if (monitor.isCanceled())               return handledCancelRequest("String_Node_Str");
            }
 catch (            Exception e) {
              return handleException(monitor,e,"String_Node_Str");
            }
          }
 else {
            try {
              monitor.subTask("String_Node_Str");
              if (monitor.isCanceled())               return handledCancelRequest("String_Node_Str");
              if (monitor.isCanceled())               return handledCancelRequest("String_Node_Str");
              rc.crawlBrowse(outputDir,month,day,year,presidentNameMap.get(presidentIndex),documentCategoryMap.get(documentIndex),monitor);
            }
 catch (            Exception e) {
              return handleException(monitor,e,"String_Node_Str");
            }
          }
          try {
            Display.getDefault().syncExec(new Runnable(){
              @Override public void run(){
                CorpusClass cc=new CorpusClass("String_Node_Str",outputDir);
                cc.setParent(americanPresidencyCorpus);
                americanPresidencyCorpus.addClass(cc);
              }
            }
);
          }
 catch (          Exception e) {
            e.printStackTrace();
            return Status.CANCEL_STATUS;
          }
          try {
            ManageCorpora.saveCorpus(americanPresidencyCorpus);
          }
 catch (          Exception e) {
            e.printStackTrace();
            return Status.CANCEL_STATUS;
          }
          if (monitor.isCanceled())           return handledCancelRequest("String_Node_Str");
          monitor.worked(10);
          monitor.done();
          return Status.OK_STATUS;
        }
      }
;
      job.setUser(true);
      canProceed=canItProceed();
      if (canProceed) {
        job.schedule();
        job.addJobChangeListener(new JobChangeAdapter(){
          public void done(          IJobChangeEvent event){
            if (!event.getResult().isOK()) {
              TacitFormComposite.writeConsoleHeaderBegining("String_Node_Str");
              TacitFormComposite.updateStatusMessage(getViewSite(),"String_Node_Str",IStatus.INFO,form);
            }
 else {
              TacitFormComposite.writeConsoleHeaderBegining("String_Node_Str");
              TacitFormComposite.updateStatusMessage(getViewSite(),"String_Node_Str",IStatus.INFO,form);
              ConsoleView.printlInConsoleln("String_Node_Str");
              ConsoleView.printlInConsoleln("String_Node_Str");
            }
          }
        }
);
      }
    }
  }
);
  Action helpAction=new Action(){
    @Override public ImageDescriptor getImageDescriptor(){
      return (AmericanPresidencyCrawlerViewImageRegistry.getImageIconFactory().getImageDescriptor(IMAGE_HELP_CO));
    }
    @Override public String getToolTipText(){
      return "String_Node_Str";
    }
    @Override public void run(){
      PlatformUI.getWorkbench().getHelpSystem().displayHelp("String_Node_Str");
    }
  }
;
  mgr.add(helpAction);
  PlatformUI.getWorkbench().getHelpSystem().setHelp(helpAction,"String_Node_Str");
  PlatformUI.getWorkbench().getHelpSystem().setHelp(form,"String_Node_Str");
  form.getToolBarManager().update(true);
}

Fixed version (ground truth):
private void addButtonsToToolBar(){
  IToolBarManager mgr=form.getToolBarManager();
  mgr.add(new Action(){
    @Override public ImageDescriptor getImageDescriptor(){
      return (AmericanPresidencyCrawlerViewImageRegistry.getImageIconFactory().getImageDescriptor(IMAGE_LRUN_OBJ));
    }
    @Override public String getToolTipText(){
      return "String_Node_Str";
    }
    String month, day, year;
    String outputDir;
    int presidentIndex;
    int documentIndex;
    String corpusName;
    boolean browse;
    boolean canProceed;
    String query1;
    String query2;
    Calendar from=null;
    Calendar to=null;
    String operator;
    @Override public void run(){
      final Job job=new Job("String_Node_Str"){
        @Override protected IStatus run(        IProgressMonitor monitor){
          TacitFormComposite.setConsoleViewInFocus();
          TacitFormComposite.updateStatusMessage(getViewSite(),null,null,form);
          Display.getDefault().syncExec(new Runnable(){
            @Override public void run(){
              browse=dateCheckBrowse.getSelection();
              corpusName=corpusNameTxt.getText();
              if (!browse) {
                if (andButton.getSelection())                 operator="String_Node_Str";
 else                 if (orButton.getSelection())                 operator="String_Node_Str";
 else                 operator="String_Node_Str";
                query1=searchText1.getText();
                query2=searchText2.getText();
                presidentIndex=selectPresidentSearch.getSelectionIndex();
                documentIndex=selectDocumentSearch.getSelectionIndex();
                if (dateCheckSearch.getSelection()) {
                  from=Calendar.getInstance();
                  from.set(fromDate.getYear(),fromDate.getMonth(),fromDate.getDay());
                  to=Calendar.getInstance();
                  to.set(toDate.getYear(),toDate.getMonth(),toDate.getDay());
                }
              }
 else {
                month=browseMonth.getSelectionIndex() == 0 ? "String_Node_Str" : months[browseMonth.getSelectionIndex()];
                day=browseDay.getSelectionIndex() == 0 ? "String_Node_Str" : days[browseDay.getSelectionIndex()];
                year=browseYear.getSelectionIndex() == 0 ? "String_Node_Str" : years[browseYear.getSelectionIndex()];
                documentIndex=selectDocumentSearch.getSelectionIndex();
                presidentIndex=selectPresidentSearch.getSelectionIndex();
              }
              Date dateObj=new Date();
              corpusName+="String_Node_Str" + dateObj.getTime();
              outputDir=IAmericanPresidencyCrawlerViewConstants.DEFAULT_CORPUS_LOCATION + File.separator + corpusName;
              if (!new File(outputDir).exists()) {
                new File(outputDir).mkdirs();
              }
            }
          }
);
          int progressSize=1000;
          monitor.beginTask("String_Node_Str",progressSize);
          TacitFormComposite.writeConsoleHeaderBegining("String_Node_Str");
          final AmericanPresidencyCrawler rc=new AmericanPresidencyCrawler();
          monitor.subTask("String_Node_Str");
          monitor.worked(10);
          if (monitor.isCanceled())           handledCancelRequest("String_Node_Str");
          americanPresidencyCorpus=new Corpus(corpusName,CMDataType.PRESIDENCY_JSON);
          if (!browse) {
            try {
              monitor.subTask("String_Node_Str");
              if (monitor.isCanceled())               return handledCancelRequest("String_Node_Str");
              rc.crawlSearch(outputDir,query1,query2,operator,from,to,presidentNameMap.get(presidentIndex),documentCategoryMap.get(documentIndex),monitor);
              if (monitor.isCanceled())               return handledCancelRequest("String_Node_Str");
            }
 catch (            IndexOutOfBoundsException e) {
              System.out.println(e);
              Display.getDefault().syncExec(new Runnable(){
                @Override public void run(){
                  MessageDialog dialog=new MessageDialog(null,"String_Node_Str",null,"String_Node_Str",MessageDialog.INFORMATION,new String[]{"String_Node_Str"},1);
                  int result=dialog.open();
                  if (result <= 0) {
                    dialog.close();
                  }
                }
              }
);
            }
catch (            Exception e) {
              return handleException(monitor,e,"String_Node_Str");
            }
          }
 else {
            try {
              monitor.subTask("String_Node_Str");
              if (monitor.isCanceled())               return handledCancelRequest("String_Node_Str");
              if (monitor.isCanceled())               return handledCancelRequest("String_Node_Str");
              rc.crawlBrowse(outputDir,month,day,year,presidentNameMap.get(presidentIndex),documentCategoryMap.get(documentIndex),monitor);
            }
 catch (            IndexOutOfBoundsException e) {
              Display.getDefault().syncExec(new Runnable(){
                @Override public void run(){
                  MessageDialog dialog=new MessageDialog(null,"String_Node_Str",null,"String_Node_Str",MessageDialog.INFORMATION,new String[]{"String_Node_Str"},1);
                  int result=dialog.open();
                  if (result <= 0) {
                    dialog.close();
                  }
                }
              }
);
            }
catch (            Exception e) {
              return handleException(monitor,e,"String_Node_Str");
            }
          }
          try {
            Display.getDefault().syncExec(new Runnable(){
              @Override public void run(){
                CorpusClass cc=new CorpusClass("String_Node_Str",outputDir);
                cc.setParent(americanPresidencyCorpus);
                americanPresidencyCorpus.addClass(cc);
              }
            }
);
          }
 catch (          Exception e) {
            e.printStackTrace();
            return Status.CANCEL_STATUS;
          }
          try {
            ManageCorpora.saveCorpus(americanPresidencyCorpus);
          }
 catch (          Exception e) {
            e.printStackTrace();
            return Status.CANCEL_STATUS;
          }
          if (monitor.isCanceled())           return handledCancelRequest("String_Node_Str");
          monitor.worked(10);
          monitor.done();
          return Status.OK_STATUS;
        }
      }
;
      job.setUser(true);
      canProceed=canItProceed();
      if (canProceed) {
        job.schedule();
        job.addJobChangeListener(new JobChangeAdapter(){
          public void done(          IJobChangeEvent event){
            if (!event.getResult().isOK()) {
              TacitFormComposite.writeConsoleHeaderBegining("String_Node_Str");
              TacitFormComposite.updateStatusMessage(getViewSite(),"String_Node_Str",IStatus.INFO,form);
            }
 else {
              TacitFormComposite.writeConsoleHeaderBegining("String_Node_Str");
              TacitFormComposite.updateStatusMessage(getViewSite(),"String_Node_Str",IStatus.INFO,form);
              ConsoleView.printlInConsoleln("String_Node_Str");
              ConsoleView.printlInConsoleln("String_Node_Str");
            }
          }
        }
);
      }
    }
  }
);
  Action helpAction=new Action(){
    @Override public ImageDescriptor getImageDescriptor(){
      return (AmericanPresidencyCrawlerViewImageRegistry.getImageIconFactory().getImageDescriptor(IMAGE_HELP_CO));
    }
    @Override public String getToolTipText(){
      return "String_Node_Str";
    }
    @Override public void run(){
      PlatformUI.getWorkbench().getHelpSystem().displayHelp("String_Node_Str");
    }
  }
;
  mgr.add(helpAction);
  PlatformUI.getWorkbench().getHelpSystem().setHelp(helpAction,"String_Node_Str");
  PlatformUI.getWorkbench().getHelpSystem().setHelp(form,"String_Node_Str");
  form.getToolBarManager().update(true);
}