Program: 136020
Project: 136020
Buggy source:
/** 
 * This method schedules a long running job that runs tla2tex on the file to translate and loads it in the browser that is part of the second tab of the tlaEditorAndPDFViewer. It is done as a long running job so that the UI thread is not locked while tla2tex runs. This handles any unrecoverable error in tla2tex translation and presents it to the user as an error message. If the user has the pdf file in the .toolbox directory open in another program, then the toolbox will show a warning stating that the new pdf file could not be created. It will display the old, unmodified pdf file to the user.
 * @param tlaEditorAndPDFViewer
 * @param fileToTranslate
 */
private void runPDFJob(final TLAEditorAndPDFViewer tlaEditorAndPDFViewer,final IResource fileToTranslate){
  Job tla2TexJob=new Job("String_Node_Str"){
    protected IStatus run(    final IProgressMonitor monitor){
      try {
        Vector tla2texArgs=new Vector();
        IPreferenceStore preferenceStore=TLA2TeXActivator.getDefault().getPreferenceStore();
        if (preferenceStore.getBoolean(ITLA2TeXPreferenceConstants.SHADE_COMMENTS)) {
          tla2texArgs.add("String_Node_Str");
        }
        if (preferenceStore.getBoolean(ITLA2TeXPreferenceConstants.NUMBER_LINES)) {
          tla2texArgs.add("String_Node_Str");
        }
        tla2texArgs.add("String_Node_Str");
        String latexCommand=preferenceStore.getString(ITLA2TeXPreferenceConstants.LATEX_COMMAND);
        tla2texArgs.add(latexCommand);
        tla2texArgs.add("String_Node_Str");
        tla2texArgs.add(Double.toString(preferenceStore.getDouble(ITLA2TeXPreferenceConstants.GRAY_LEVEL)));
        tla2texArgs.add("String_Node_Str");
        tla2texArgs.add(TLA2TeX_Output_Extension);
        tla2texArgs.add("String_Node_Str");
        tla2texArgs.add(fileToTranslate.getProject().getLocation().toOSString());
        tla2texArgs.add(fileToTranslate.getLocation().toOSString());
        final long translationStartTime=System.currentTimeMillis();
        monitor.beginTask("String_Node_Str",2);
        monitor.subTask("String_Node_Str");
        TLA.runTranslation((String[])tla2texArgs.toArray(new String[tla2texArgs.size()]));
        monitor.worked(1);
        final String outputFileName=fileToTranslate.getProject().getLocation().toOSString() + File.separator + ResourceHelper.getModuleName(fileToTranslate)+ "String_Node_Str"+ TLA2TeX_Output_Extension;
        final File outputFile=new File(outputFileName);
        if (outputFile.exists()) {
          UIHelper.runUISync(new Runnable(){
            public void run(){
              monitor.subTask("String_Node_Str");
              tlaEditorAndPDFViewer.setActivePage(TLAEditorAndPDFViewer.PDFPage_ID);
              tlaEditorAndPDFViewer.getPDFViewingPage().getBrowser().setUrl(outputFileName);
              monitor.worked(1);
              if (outputFile.lastModified() < translationStartTime) {
                MessageDialog.openWarning(UIHelper.getShellProvider().getShell(),"String_Node_Str","String_Node_Str" + "String_Node_Str" + outputFileName + "String_Node_Str");
              }
            }
          }
);
        }
 else {
          UIHelper.runUISync(new Runnable(){
            public void run(){
              MessageDialog.openError(UIHelper.getShellProvider().getShell(),"String_Node_Str","String_Node_Str");
            }
          }
);
        }
      }
 catch (      final TLA2TexException e) {
        Activator.logError("String_Node_Str" + e.getMessage(),e);
        UIHelper.runUISync(new Runnable(){
          public void run(){
            MessageDialog.openError(UIHelper.getShellProvider().getShell(),"String_Node_Str",e.getMessage());
          }
        }
);
      }
 finally {
      }
      return Status.OK_STATUS;
    }
  }
;
  tla2TexJob.setUser(true);
  tla2TexJob.setPriority(Job.LONG);
  tla2TexJob.schedule();
}

Fixed version (ground truth):
/** 
 * This method schedules a long running job that runs tla2tex on the file to translate and loads it in the browser that is part of the second tab of the tlaEditorAndPDFViewer. It is done as a long running job so that the UI thread is not locked while tla2tex runs. This handles any unrecoverable error in tla2tex translation and presents it to the user as an error message. If the user has the pdf file in the .toolbox directory open in another program, then the toolbox will show a warning stating that the new pdf file could not be created. It will display the old, unmodified pdf file to the user.
 * @param tlaEditorAndPDFViewer
 * @param fileToTranslate
 */
private void runPDFJob(final TLAEditorAndPDFViewer tlaEditorAndPDFViewer,final IResource fileToTranslate){
  Job tla2TexJob=new Job("String_Node_Str"){
    protected IStatus run(    final IProgressMonitor monitor){
      try {
        Vector tla2texArgs=new Vector();
        IPreferenceStore preferenceStore=TLA2TeXActivator.getDefault().getPreferenceStore();
        if (preferenceStore.getBoolean(ITLA2TeXPreferenceConstants.SHADE_COMMENTS)) {
          tla2texArgs.add("String_Node_Str");
          tla2texArgs.add("String_Node_Str");
        }
        if (preferenceStore.getBoolean(ITLA2TeXPreferenceConstants.NUMBER_LINES)) {
          tla2texArgs.add("String_Node_Str");
        }
        tla2texArgs.add("String_Node_Str");
        String latexCommand=preferenceStore.getString(ITLA2TeXPreferenceConstants.LATEX_COMMAND);
        tla2texArgs.add(latexCommand);
        tla2texArgs.add("String_Node_Str");
        tla2texArgs.add(Double.toString(preferenceStore.getDouble(ITLA2TeXPreferenceConstants.GRAY_LEVEL)));
        tla2texArgs.add("String_Node_Str");
        tla2texArgs.add(TLA2TeX_Output_Extension);
        tla2texArgs.add("String_Node_Str");
        tla2texArgs.add(fileToTranslate.getProject().getLocation().toOSString());
        tla2texArgs.add(fileToTranslate.getLocation().toOSString());
        final long translationStartTime=System.currentTimeMillis();
        monitor.beginTask("String_Node_Str",2);
        monitor.subTask("String_Node_Str");
        TLA.runTranslation((String[])tla2texArgs.toArray(new String[tla2texArgs.size()]));
        monitor.worked(1);
        final String outputFileName=fileToTranslate.getProject().getLocation().toOSString() + File.separator + ResourceHelper.getModuleName(fileToTranslate)+ "String_Node_Str"+ TLA2TeX_Output_Extension;
        final File outputFile=new File(outputFileName);
        if (outputFile.exists()) {
          UIHelper.runUISync(new Runnable(){
            public void run(){
              monitor.subTask("String_Node_Str");
              tlaEditorAndPDFViewer.setActivePage(TLAEditorAndPDFViewer.PDFPage_ID);
              tlaEditorAndPDFViewer.getPDFViewingPage().getBrowser().setUrl(outputFileName);
              monitor.worked(1);
              if (outputFile.lastModified() < translationStartTime) {
                MessageDialog.openWarning(UIHelper.getShellProvider().getShell(),"String_Node_Str","String_Node_Str" + "String_Node_Str" + outputFileName + "String_Node_Str");
              }
            }
          }
);
        }
 else {
          UIHelper.runUISync(new Runnable(){
            public void run(){
              MessageDialog.openError(UIHelper.getShellProvider().getShell(),"String_Node_Str","String_Node_Str");
            }
          }
);
        }
      }
 catch (      final TLA2TexException e) {
        Activator.logError("String_Node_Str" + e.getMessage(),e);
        UIHelper.runUISync(new Runnable(){
          public void run(){
            MessageDialog.openError(UIHelper.getShellProvider().getShell(),"String_Node_Str",e.getMessage());
          }
        }
);
      }
 finally {
      }
      return Status.OK_STATUS;
    }
  }
;
  tla2TexJob.setUser(true);
  tla2TexJob.setPriority(Job.LONG);
  tla2TexJob.schedule();
}