Program: 51682
Project: 51682
Buggy source:
void register(){
  if (isVirtual()) {
    return;
  }
  ArrayList list=new ArrayList();
  Member[] measures=getMeasures();
  for (int i=0; i < measures.length; i++) {
    if (measures[i] instanceof RolapStoredMeasure) {
      list.add(measures[i]);
    }
  }
  RolapStoredMeasure[] storedMeasures=(RolapStoredMeasure[])list.toArray(new RolapStoredMeasure[list.size()]);
  for (int i=0; i < storedMeasures.length; i++) {
    RolapStoredMeasure storedMeasure=storedMeasures[i];
    RolapStar star=RolapStar.Pool.instance().getOrCreateStar(schema,this.fact);
    RolapStar.Measure measure=new RolapStar.Measure();
    measure.table=star.factTable;
    measure.expression=storedMeasure.expression;
    measure.aggregator=storedMeasure.aggregator;
    measure.isNumeric=true;
    storedMeasure.starMeasure=measure;
    star.factTable.columns.add(measure);
    RolapDimension[] dimensions=(RolapDimension[])this.getDimensions();
    for (int j=0; j < dimensions.length; j++) {
      RolapDimension dimension=dimensions[j];
      RolapHierarchy[] hierarchies=(RolapHierarchy[])dimension.getHierarchies();
      for (int k=0; k < hierarchies.length; k++) {
        RolapHierarchy hierarchy=hierarchies[k];
        HierarchyUsage hierarchyUsage=schema.getUsage(hierarchy,this);
        MondrianDef.Relation relation=hierarchy.getRelation();
        if (relation == null) {
          continue;
        }
        RolapStar.Table table=star.factTable;
        if (!relation.equals(table.relation)) {
          RolapStar.Condition joinCondition=new RolapStar.Condition(table.getAlias(),hierarchyUsage.foreignKey,hierarchyUsage.primaryKeyTable.getAlias(),hierarchyUsage.primaryKey);
          table=table.addJoin(relation,joinCondition);
        }
        RolapLevel[] levels=(RolapLevel[])hierarchy.getLevels();
        for (int l=0; l < levels.length; l++) {
          RolapLevel level=levels[l];
          if (level.nameExp == null) {
            continue;
          }
 else {
            RolapStar.Column column=new RolapStar.Column();
            if (level.nameExp instanceof MondrianDef.Column) {
              column.table=table.findDescendant(((MondrianDef.Column)level.nameExp).table);
            }
 else {
              column.table=table;
            }
            column.expression=level.nameExp;
            column.isNumeric=(level.flags & RolapLevel.NUMERIC) != 0;
            table.columns.add(column);
            star.mapLevelToColumn.put(level,column);
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
void register(){
  if (isVirtual()) {
    return;
  }
  ArrayList list=new ArrayList();
  Member[] measures=getMeasures();
  for (int i=0; i < measures.length; i++) {
    if (measures[i] instanceof RolapStoredMeasure) {
      list.add(measures[i]);
    }
  }
  RolapStoredMeasure[] storedMeasures=(RolapStoredMeasure[])list.toArray(new RolapStoredMeasure[list.size()]);
  for (int i=0; i < storedMeasures.length; i++) {
    RolapStoredMeasure storedMeasure=storedMeasures[i];
    RolapStar star=RolapStar.Pool.instance().getOrCreateStar(schema,this.fact);
    RolapStar.Measure measure=new RolapStar.Measure();
    measure.table=star.factTable;
    measure.expression=storedMeasure.expression;
    measure.aggregator=storedMeasure.aggregator;
    measure.isNumeric=true;
    storedMeasure.starMeasure=measure;
    star.factTable.columns.add(measure);
    RolapDimension[] dimensions=(RolapDimension[])this.getDimensions();
    for (int j=0; j < dimensions.length; j++) {
      RolapDimension dimension=dimensions[j];
      RolapHierarchy[] hierarchies=(RolapHierarchy[])dimension.getHierarchies();
      for (int k=0; k < hierarchies.length; k++) {
        RolapHierarchy hierarchy=hierarchies[k];
        HierarchyUsage hierarchyUsage=schema.getUsage(hierarchy,this);
        MondrianDef.Relation relation=hierarchy.getRelation();
        if (relation == null) {
          continue;
        }
        RolapStar.Table table=star.factTable;
        if (!relation.equals(table.relation)) {
          RolapStar.Condition joinCondition=new RolapStar.Condition(table.getAlias(),hierarchyUsage.foreignKey,hierarchyUsage.primaryKeyTable.getAlias(),hierarchyUsage.primaryKey);
          table=table.addJoin(relation,joinCondition);
        }
        RolapLevel[] levels=(RolapLevel[])hierarchy.getLevels();
        for (int l=0; l < levels.length; l++) {
          RolapLevel level=levels[l];
          if (level.nameExp == null) {
            continue;
          }
 else {
            RolapStar.Column column=new RolapStar.Column();
            if (level.nameExp instanceof MondrianDef.Column) {
              String tableName=((MondrianDef.Column)level.nameExp).table;
              column.table=table.findAncestor(tableName);
              if (column.table == null) {
                throw Util.newError("String_Node_Str" + level.getUniqueName() + "String_Node_Str"+ this+ "String_Node_Str"+ tableName+ "String_Node_Str");
              }
            }
 else {
              column.table=table;
            }
            column.expression=level.nameExp;
            column.isNumeric=(level.flags & RolapLevel.NUMERIC) != 0;
            table.columns.add(column);
            star.mapLevelToColumn.put(level,column);
          }
        }
      }
    }
  }
}