Program: 136150
Project: 136150
Buggy source:
/** 
 * Calls SANY, that parses the root module. <br> <b>Note:</b> This method fills the error objects   {@link ParseHandler#parseErrors} and{@link ParseHandler#semanticErrors}. Call   {@link ParseHandler#processParsingErrors(Spec)} to store thisinformation in the specification handle
 * @param doSemanticAnalysis if true, the semantical phase will be started
 * @param rootFilename filename of the root module
 * @return status of parsing, one of the {@link IParseConstants} constants
 */
private int parseMainModule(boolean doSemanticAnalysis,Spec spec){
  String rootFilename=spec.getRootFilename();
  this.cleanUp();
  int specStatus=0;
  PrintStream outputStr=ToolIO.err;
  SpecObj moduleSpec=new SpecObj(ResourceHelper.getModuleName(rootFilename),new RCPNameToFileIStream(null));
  ToolIO.reset();
  ToolIO.setMode(ToolIO.TOOL);
  try {
    SANY.frontEndInitialize(moduleSpec,outputStr);
    SANY.frontEndParse(moduleSpec,outputStr);
    if (doSemanticAnalysis) {
      SANY.frontEndSemanticAnalysis(moduleSpec,outputStr,true);
    }
  }
 catch (  InitException e) {
    specStatus=IParseConstants.UNKNOWN_ERROR;
    return specStatus;
  }
catch (  ParseException e) {
    specStatus=IParseConstants.SYNTAX_ERROR;
    parseErrors=moduleSpec.getParseErrors();
  }
catch (  SemanticException e) {
    specStatus=IParseConstants.SEMANTIC_ERROR;
  }
  if (specStatus > IParseConstants.SYNTAX_ERROR) {
    semanticErrors=moduleSpec.semanticErrors;
    if (semanticErrors != null) {
      if (semanticErrors.getNumMessages() > 0) {
        if (semanticErrors.isSuccess()) {
          specStatus=IParseConstants.SEMANTIC_WARNING;
        }
 else {
          specStatus=IParseConstants.SEMANTIC_ERROR;
        }
      }
    }
  }
  Vector userModules=new Vector();
  Vector standardModules=new Vector();
  boolean rootModuleFound=false;
  Enumeration enumerate=moduleSpec.parseUnitContext.keys();
  while (enumerate.hasMoreElements()) {
    String moduleName=(String)enumerate.nextElement();
    ParseUnit parseUnit=(ParseUnit)moduleSpec.parseUnitContext.get(moduleName);
    String absoluteFileName=null;
    if (parseUnit.getNis() != null) {
      File sourceFile=parseUnit.getNis().sourceFile();
      if (sourceFile != null) {
        absoluteFileName=sourceFile.getAbsolutePath();
      }
    }
    if (absoluteFileName == null) {
      throw new RuntimeException("String_Node_Str");
    }
    Module module=new Module(absoluteFileName);
    if (specStatus > IParseConstants.SEMANTIC_ERROR) {
      ExternalModuleTable.ExternalModuleTableEntry emt=(ExternalModuleTable.ExternalModuleTableEntry)moduleSpec.getExternalModuleTable().moduleHashTable.get(UniqueString.uniqueStringOf(module.getModuleName()));
      if (emt != null) {
        module.setNode(emt.getModuleNode());
      }
    }
    if (module.getModuleName().equals(ResourceHelper.getModuleName(rootFilename))) {
      rootModuleFound=true;
    }
    if (module.isStandardModule()) {
      standardModules.addElement(module);
    }
 else {
      userModules.addElement(module);
    }
  }
  if (!rootModuleFound) {
    specStatus=IParseConstants.COULD_NOT_FIND_MODULE;
  }
  return specStatus;
}

Fixed version (ground truth):
/** 
 * Calls SANY, that parses the root module. <br> <b>Note:</b> This method fills the error objects   {@link ParseHandler#parseErrors} and{@link ParseHandler#semanticErrors}. Call   {@link ParseHandler#processParsingErrors(Spec)} to store thisinformation in the specification handle
 * @param doSemanticAnalysis if true, the semantical phase will be started
 * @param rootFilename filename of the root module
 * @return status of parsing, one of the {@link IParseConstants} constants
 */
private int parseMainModule(boolean doSemanticAnalysis,Spec spec){
  String rootFilename=spec.getRootFilename();
  this.cleanUp();
  int specStatus=0;
  SpecObj moduleSpec=new SpecObj(ResourceHelper.getModuleName(rootFilename),new RCPNameToFileIStream(null));
  ToolIO.reset();
  ToolIO.setMode(ToolIO.TOOL);
  PrintStream outputStr=ToolIO.err;
  try {
    SANY.frontEndInitialize(moduleSpec,outputStr);
    SANY.frontEndParse(moduleSpec,outputStr);
    if (doSemanticAnalysis) {
      SANY.frontEndSemanticAnalysis(moduleSpec,outputStr,true);
    }
  }
 catch (  InitException e) {
    specStatus=IParseConstants.UNKNOWN_ERROR;
    return specStatus;
  }
catch (  ParseException e) {
    specStatus=IParseConstants.SYNTAX_ERROR;
    parseErrors=moduleSpec.getParseErrors();
  }
catch (  SemanticException e) {
    specStatus=IParseConstants.SEMANTIC_ERROR;
  }
  if (specStatus > IParseConstants.SYNTAX_ERROR) {
    semanticErrors=moduleSpec.semanticErrors;
    if (semanticErrors != null) {
      if (semanticErrors.getNumMessages() > 0) {
        if (semanticErrors.isSuccess()) {
          specStatus=IParseConstants.SEMANTIC_WARNING;
        }
 else {
          specStatus=IParseConstants.SEMANTIC_ERROR;
        }
      }
    }
  }
  Vector userModules=new Vector();
  Vector standardModules=new Vector();
  boolean rootModuleFound=false;
  Enumeration enumerate=moduleSpec.parseUnitContext.keys();
  while (enumerate.hasMoreElements()) {
    String moduleName=(String)enumerate.nextElement();
    ParseUnit parseUnit=(ParseUnit)moduleSpec.parseUnitContext.get(moduleName);
    String absoluteFileName=null;
    if (parseUnit.getNis() != null) {
      File sourceFile=parseUnit.getNis().sourceFile();
      if (sourceFile != null) {
        absoluteFileName=sourceFile.getAbsolutePath();
      }
    }
    if (absoluteFileName == null) {
      throw new RuntimeException("String_Node_Str");
    }
    Module module=new Module(absoluteFileName);
    ResourceHelper.getLinkedFile(spec.getProject(),module.getAbsolutePath(),true);
    if (specStatus > IParseConstants.SEMANTIC_ERROR) {
      ExternalModuleTable.ExternalModuleTableEntry emt=(ExternalModuleTable.ExternalModuleTableEntry)moduleSpec.getExternalModuleTable().moduleHashTable.get(UniqueString.uniqueStringOf(module.getModuleName()));
      if (emt != null) {
        module.setNode(emt.getModuleNode());
      }
    }
    if (module.getModuleName().equals(ResourceHelper.getModuleName(rootFilename))) {
      rootModuleFound=true;
    }
    if (module.isStandardModule()) {
      standardModules.addElement(module);
    }
 else {
      userModules.addElement(module);
    }
  }
  if (!rootModuleFound) {
    specStatus=IParseConstants.COULD_NOT_FIND_MODULE;
  }
  return specStatus;
}