Program: 136040
Project: 136040
Buggy source:
/** 
 * We use this method to check for parsing errors and to determine the level of each trace explorer expression, i.e. whether there are primed variables or not. If an expression is a temporal formula, this should show an error to the user.
 */
public boolean finalLaunchCheck(ILaunchConfiguration configuration,String mode,IProgressMonitor monitor) throws CoreException {
  monitor.beginTask("String_Node_Str",4);
  IProject project=ResourceHelper.getProject(specName);
  IFolder launchDir=project.getFolder(modelName);
  IFile rootModule=launchDir.getFile(ModelHelper.TE_FILE_TLA);
  monitor.worked(1);
  IParseResult parseResult=ToolboxHandle.parseModule(rootModule,new SubProgressMonitor(monitor,1),false,false);
  Assert.isTrue(parseResult instanceof ParseResult,"String_Node_Str");
  if (parseResult.getDetectedErrors().size() > 0) {
    StringBuffer errorMessage=new StringBuffer();
    Iterator it=parseResult.getDetectedErrors().iterator();
    while (it.hasNext()) {
      Object next=it.next();
      if (next instanceof TLAMarkerInformationHolder) {
        errorMessage.append(((TLAMarkerInformationHolder)next).getMessage() + "String_Node_Str");
      }
 else {
        TLCActivator.logDebug("String_Node_Str" + "String_Node_Str");
      }
    }
    MessageDialog.openError(UIHelper.getShellProvider().getShell(),"String_Node_Str",errorMessage.toString());
    return false;
  }
  OpDefNode[] opDefNodes=((ParseResult)parseResult).getSpecObj().getExternalModuleTable().getRootModule().getOpDefs();
  Hashtable nodeTable=new Hashtable(opDefNodes.length);
  Assert.isNotNull(opDefNodes,"String_Node_Str");
  for (int j=0; j < opDefNodes.length; j++) {
    String key=opDefNodes[j].getName().toString();
    nodeTable.put(key,opDefNodes[j]);
  }
  for (int i=0; i < traceExpressionData.length; i++) {
    OpDefNode opDefNode=(OpDefNode)nodeTable.get(traceExpressionData[i].getIdentifier());
    traceExpressionData[i].setLevel(opDefNode.getBody().getLevel());
  }
  ModelHelper.createOrClearFiles(new IFile[]{tlaFile,cfgFile,outFile},monitor);
  monitor.subTask("String_Node_Str");
  ModelWriter writer=new ModelWriter();
  writer.addTraceExplorerExpressionInfoComments(traceExpressionData);
  writer.addPrimer(ModelHelper.TE_MODEL_NAME,ResourceHelper.getModuleName(specRootFilename));
  writer.addTraceExprVarDecsAndDefsPostParse(traceExpressionData,TRACE_EXPLORE_EXPRESSIONS);
  writeModelInfo(configuration,writer);
  writer.addFormulaList(ModelWriter.createTraceInitContent(configuration.getAttribute(TRACE_INIT,EMPTY_STRING),traceExpressionData),"String_Node_Str","String_Node_Str");
  writer.addFormulaList(ModelWriter.createTraceNextContent(configuration.getAttribute(TRACE_NEXT,new Vector()),traceExpressionData),"String_Node_Str","String_Node_Str");
  boolean isBackToState=configuration.getAttribute(IS_TRACE_BACK_TO_STATE,false);
  boolean isStuttering=configuration.getAttribute(IS_TRACE_STUTTERING,false);
  String finalStateConj=configuration.getAttribute(TRACE_FINAL_STATE,EMPTY_STRING);
  if (isStuttering) {
    writer.addStutteringPropertyForTraceExplorer(finalStateConj);
  }
 else   if (isBackToState) {
    writer.addBackToStatePropertyForTraceExplorer(finalStateConj,configuration.getAttribute(TRACE_BACK_TO_STATE,EMPTY_STRING));
  }
 else {
    writer.addInvariantForTraceExplorer(finalStateConj);
  }
  writer.writeFiles(tlaFile,cfgFile,monitor);
  IFolder modelFolder=project.getFolder(modelName);
  modelFolder.refreshLocal(IResource.DEPTH_ONE,new SubProgressMonitor(monitor,100));
  return true;
}

Fixed version (ground truth):
/** 
 * We use this method to check for parsing errors and to determine the level of each trace explorer expression, i.e. whether there are primed variables or not. If an expression is a temporal formula, this should show an error to the user.
 */
public boolean finalLaunchCheck(ILaunchConfiguration configuration,String mode,IProgressMonitor monitor) throws CoreException {
  monitor.beginTask("String_Node_Str",4);
  IProject project=ResourceHelper.getProject(specName);
  IFolder launchDir=project.getFolder(modelName);
  IFile rootModule=launchDir.getFile(ModelHelper.TE_FILE_TLA);
  monitor.worked(1);
  IParseResult parseResult=ToolboxHandle.parseModule(rootModule,new SubProgressMonitor(monitor,1),false,false);
  Assert.isTrue(parseResult instanceof ParseResult,"String_Node_Str");
  if (parseResult.getDetectedErrors().size() > 0) {
    StringBuffer errorMessage=new StringBuffer();
    Iterator it=parseResult.getDetectedErrors().iterator();
    while (it.hasNext()) {
      Object next=it.next();
      if (next instanceof TLAMarkerInformationHolder) {
        TLAMarkerInformationHolder errorInfo=(TLAMarkerInformationHolder)next;
        if (errorInfo.getModuleName().equals(ModelHelper.TE_MODEL_NAME)) {
          errorMessage.append(errorInfo.getMessage() + "String_Node_Str");
        }
 else {
          errorMessage.append(errorInfo.getMessage() + "String_Node_Str");
        }
      }
 else {
        TLCActivator.logDebug("String_Node_Str" + "String_Node_Str");
      }
    }
    MessageDialog.openError(UIHelper.getShellProvider().getShell(),"String_Node_Str",errorMessage.toString());
    return false;
  }
  OpDefNode[] opDefNodes=((ParseResult)parseResult).getSpecObj().getExternalModuleTable().getRootModule().getOpDefs();
  Hashtable nodeTable=new Hashtable(opDefNodes.length);
  Assert.isNotNull(opDefNodes,"String_Node_Str");
  for (int j=0; j < opDefNodes.length; j++) {
    String key=opDefNodes[j].getName().toString();
    nodeTable.put(key,opDefNodes[j]);
  }
  Vector levelThreeExpressions=new Vector();
  for (int i=0; i < traceExpressionData.length; i++) {
    OpDefNode opDefNode=(OpDefNode)nodeTable.get(traceExpressionData[i].getIdentifier());
    int level=opDefNode.getBody().getLevel();
    traceExpressionData[i].setLevel(level);
    if (level == 3) {
      levelThreeExpressions.add(traceExpressionData[i]);
    }
  }
  if (!levelThreeExpressions.isEmpty()) {
    StringBuffer errorBuffer=new StringBuffer();
    errorBuffer.append("String_Node_Str");
    Iterator it=levelThreeExpressions.iterator();
    while (it.hasNext()) {
      TraceExpressionInformationHolder expressionInfo=(TraceExpressionInformationHolder)it.next();
      errorBuffer.append(expressionInfo.getExpression() + "String_Node_Str");
    }
    MessageDialog.openError(UIHelper.getShellProvider().getShell(),"String_Node_Str",errorBuffer.toString());
    return false;
  }
  ModelHelper.createOrClearFiles(new IFile[]{tlaFile,cfgFile,outFile},monitor);
  monitor.subTask("String_Node_Str");
  ModelWriter writer=new ModelWriter();
  writer.addTraceExplorerExpressionInfoComments(traceExpressionData);
  writer.addPrimer(ModelHelper.TE_MODEL_NAME,ResourceHelper.getModuleName(specRootFilename));
  writer.addTraceExprVarDecsAndDefsPostParse(traceExpressionData,TRACE_EXPLORE_EXPRESSIONS);
  writeModelInfo(configuration,writer);
  writer.addFormulaList(ModelWriter.createTraceInitContent(configuration.getAttribute(TRACE_INIT,EMPTY_STRING),traceExpressionData),"String_Node_Str","String_Node_Str");
  writer.addFormulaList(ModelWriter.createTraceNextContent(configuration.getAttribute(TRACE_NEXT,new Vector()),traceExpressionData),"String_Node_Str","String_Node_Str");
  boolean isBackToState=configuration.getAttribute(IS_TRACE_BACK_TO_STATE,false);
  boolean isStuttering=configuration.getAttribute(IS_TRACE_STUTTERING,false);
  String finalStateConj=configuration.getAttribute(TRACE_FINAL_STATE,EMPTY_STRING);
  if (isStuttering) {
    writer.addStutteringPropertyForTraceExplorer(finalStateConj);
  }
 else   if (isBackToState) {
    writer.addBackToStatePropertyForTraceExplorer(finalStateConj,configuration.getAttribute(TRACE_BACK_TO_STATE,EMPTY_STRING));
  }
 else {
    writer.addInvariantForTraceExplorer(finalStateConj);
  }
  writer.writeFiles(tlaFile,cfgFile,monitor);
  IFolder modelFolder=project.getFolder(modelName);
  modelFolder.refreshLocal(IResource.DEPTH_ONE,new SubProgressMonitor(monitor,100));
  return true;
}