Program: 51700
Project: 51700
Buggy source:
void register(){
  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];
    ArrayList tables=new ArrayList();
    RolapStar star=RolapStar.Pool.instance().getOrCreateStar((RolapConnection)getConnection(),this.factSchema,this.factTable,this.getAlias());
    RolapStar.Measure measure=new RolapStar.Measure();
    measure.table=star.factTable;
    measure.name=storedMeasure.column;
    measure.aggregator=storedMeasure.aggregator;
    measure.isNumeric=true;
    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=hierarchy.getUsage(this);
        MondrianDef.Relation relation=hierarchy.getRelation();
        if (relation == null) {
          continue;
        }
        RolapStar.Condition joinCondition=new RolapStar.Condition(star.factTable.getAlias(),hierarchyUsage.foreignKey,hierarchy.primaryKeyTable,hierarchy.primaryKey);
        RolapStar.Table table=star.factTable.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           if (level.nameExp instanceof MondrianDef.Column) {
            MondrianDef.Column nameColumn=(MondrianDef.Column)level.nameExp;
            RolapStar.Column column=new RolapStar.Column();
            RolapStar.Table levelTable=table.findDescendant(nameColumn.table);
            column.table=levelTable;
            column.name=nameColumn.name;
            column.isNumeric=(level.flags & RolapLevel.NUMERIC) != 0;
            table.columns.add(column);
            star.mapLevelToColumn.put(level,column);
          }
 else {
            Util.newInternal("String_Node_Str" + level.nameExp);
          }
        }
        tables.add(table);
      }
    }
    star.tables=(RolapStar.Table[])tables.toArray(new RolapStar.Table[tables.size()]);
    storedMeasure.star=star;
  }
}

Fixed version (ground truth):
void register(){
  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];
    ArrayList tables=new ArrayList();
    RolapStar star=RolapStar.Pool.instance().getOrCreateStar((RolapConnection)getConnection(),this.factSchema,this.factTable,this.getAlias());
    RolapStar.Measure measure=new RolapStar.Measure();
    measure.table=star.factTable;
    measure.name=storedMeasure.column;
    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=hierarchy.getUsage(this);
        MondrianDef.Relation relation=hierarchy.getRelation();
        if (relation == null) {
          continue;
        }
        RolapStar.Condition joinCondition=new RolapStar.Condition(star.factTable.getAlias(),hierarchyUsage.foreignKey,hierarchy.primaryKeyTable,hierarchy.primaryKey);
        RolapStar.Table table=star.factTable.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           if (level.nameExp instanceof MondrianDef.Column) {
            MondrianDef.Column nameColumn=(MondrianDef.Column)level.nameExp;
            RolapStar.Column column=new RolapStar.Column();
            RolapStar.Table levelTable=table.findDescendant(nameColumn.table);
            column.table=levelTable;
            column.name=nameColumn.name;
            column.isNumeric=(level.flags & RolapLevel.NUMERIC) != 0;
            table.columns.add(column);
            star.mapLevelToColumn.put(level,column);
          }
 else {
            Util.newInternal("String_Node_Str" + level.nameExp);
          }
        }
        tables.add(table);
      }
    }
    star.tables=(RolapStar.Table[])tables.toArray(new RolapStar.Table[tables.size()]);
  }
}