Program: 51441
Project: 51441
Buggy source:
private void load(MondrianDef.Schema xmlSchema){
  this.name=xmlSchema.name;
  if (name == null || name.equals("String_Node_Str")) {
    throw Util.newError("String_Node_Str");
  }
  final Map mapNameToUdf=new HashMap();
  for (int i=0; i < xmlSchema.userDefinedFunctions.length; i++) {
    MondrianDef.UserDefinedFunction udf=xmlSchema.userDefinedFunctions[i];
    defineFunction(mapNameToUdf,udf.name,udf.className);
  }
  final RolapSchemaFunctionTable funTable=new RolapSchemaFunctionTable(mapNameToUdf.values());
  funTable.init();
  this.funTable=funTable;
  for (int i=0; i < xmlSchema.dimensions.length; i++) {
    MondrianDef.Dimension xmlDimension=xmlSchema.dimensions[i];
    if (xmlDimension.foreignKey != null) {
      throw MondrianResource.instance().PublicDimensionMustNotHaveForeignKey.ex(xmlDimension.name);
    }
  }
  Set parameterNames=new HashSet();
  for (int i=0; i < xmlSchema.parameters.length; i++) {
    MondrianDef.Parameter xmlParameter=xmlSchema.parameters[i];
    String name=xmlParameter.name;
    if (!parameterNames.add(name)) {
      throw MondrianResource.instance().DuplicateSchemaParameter.ex(name);
    }
    Type type;
    if (xmlParameter.type.equals("String_Node_Str")) {
      type=new StringType();
    }
 else     if (xmlParameter.type.equals("String_Node_Str")) {
      type=new NumericType();
    }
 else {
      type=new MemberType(null,null,null,null);
    }
    final String description=xmlParameter.description;
    final boolean modifiable=xmlParameter.modifiable.booleanValue();
    String defaultValue=xmlParameter.defaultValue;
    RolapSchemaParameter param=new RolapSchemaParameter(this,name,defaultValue,description,type,modifiable);
    Util.discard(param);
  }
  for (int i=0; i < xmlSchema.cubes.length; i++) {
    MondrianDef.Cube xmlCube=xmlSchema.cubes[i];
    if (xmlCube.isEnabled()) {
      RolapCube cube=new RolapCube(this,xmlSchema,xmlCube,true);
      Util.discard(cube);
    }
  }
  for (int i=0; i < xmlSchema.virtualCubes.length; i++) {
    MondrianDef.VirtualCube xmlVirtualCube=xmlSchema.virtualCubes[i];
    if (xmlVirtualCube.isEnabled()) {
      RolapCube cube=new RolapCube(this,xmlSchema,xmlVirtualCube,true);
      Util.discard(cube);
    }
  }
  for (int i=0; i < xmlSchema.namedSets.length; i++) {
    MondrianDef.NamedSet xmlNamedSet=xmlSchema.namedSets[i];
    mapNameToSet.put(xmlNamedSet.name,createNamedSet(xmlNamedSet));
  }
  for (int i=0; i < xmlSchema.roles.length; i++) {
    MondrianDef.Role xmlRole=xmlSchema.roles[i];
    Role role=createRole(xmlRole);
    mapNameToRole.put(xmlRole.name,role);
  }
  if (xmlSchema.defaultRole != null) {
    Role role=lookupRole(xmlSchema.defaultRole);
    if (role == null) {
      throw Util.newError("String_Node_Str" + xmlSchema.defaultRole + "String_Node_Str");
    }
    defaultRole=role;
  }
}

Fixed version (ground truth):
private void load(MondrianDef.Schema xmlSchema){
  this.name=xmlSchema.name;
  if (name == null || name.equals("String_Node_Str")) {
    throw Util.newError("String_Node_Str");
  }
  final Map mapNameToUdf=new HashMap();
  for (int i=0; i < xmlSchema.userDefinedFunctions.length; i++) {
    MondrianDef.UserDefinedFunction udf=xmlSchema.userDefinedFunctions[i];
    defineFunction(mapNameToUdf,udf.name,udf.className);
  }
  final RolapSchemaFunctionTable funTable=new RolapSchemaFunctionTable(mapNameToUdf.values());
  funTable.init();
  this.funTable=funTable;
  for (int i=0; i < xmlSchema.dimensions.length; i++) {
    MondrianDef.Dimension xmlDimension=xmlSchema.dimensions[i];
    if (xmlDimension.foreignKey != null) {
      throw MondrianResource.instance().PublicDimensionMustNotHaveForeignKey.ex(xmlDimension.name);
    }
  }
  Set parameterNames=new HashSet();
  for (int i=0; i < xmlSchema.parameters.length; i++) {
    MondrianDef.Parameter xmlParameter=xmlSchema.parameters[i];
    String name=xmlParameter.name;
    if (!parameterNames.add(name)) {
      throw MondrianResource.instance().DuplicateSchemaParameter.ex(name);
    }
    Type type;
    if (xmlParameter.type.equals("String_Node_Str")) {
      type=new StringType();
    }
 else     if (xmlParameter.type.equals("String_Node_Str")) {
      type=new NumericType();
    }
 else {
      type=new MemberType(null,null,null,null);
    }
    final String description=xmlParameter.description;
    final boolean modifiable=xmlParameter.modifiable.booleanValue();
    String defaultValue=xmlParameter.defaultValue;
    RolapSchemaParameter param=new RolapSchemaParameter(this,name,defaultValue,description,type,modifiable);
    Util.discard(param);
  }
  for (int i=0; i < xmlSchema.cubes.length; i++) {
    MondrianDef.Cube xmlCube=xmlSchema.cubes[i];
    if (xmlCube.isEnabled()) {
      RolapCube cube=new RolapCube(this,xmlSchema,xmlCube,true);
      cube.validate();
    }
  }
  for (int i=0; i < xmlSchema.virtualCubes.length; i++) {
    MondrianDef.VirtualCube xmlVirtualCube=xmlSchema.virtualCubes[i];
    if (xmlVirtualCube.isEnabled()) {
      RolapCube cube=new RolapCube(this,xmlSchema,xmlVirtualCube,true);
      Util.discard(cube);
    }
  }
  for (int i=0; i < xmlSchema.namedSets.length; i++) {
    MondrianDef.NamedSet xmlNamedSet=xmlSchema.namedSets[i];
    mapNameToSet.put(xmlNamedSet.name,createNamedSet(xmlNamedSet));
  }
  for (int i=0; i < xmlSchema.roles.length; i++) {
    MondrianDef.Role xmlRole=xmlSchema.roles[i];
    Role role=createRole(xmlRole);
    mapNameToRole.put(xmlRole.name,role);
  }
  if (xmlSchema.defaultRole != null) {
    Role role=lookupRole(xmlSchema.defaultRole);
    if (role == null) {
      throw Util.newError("String_Node_Str" + xmlSchema.defaultRole + "String_Node_Str");
    }
    defaultRole=role;
  }
}