Program: 76056
Project: 76056
Buggy source:
private void testDimensionCreate3(IDocumentManager documentManager) throws IOException, BirtException, DataException {
  ILevelDefn[] levelDefs=new ILevelDefn[3];
  String[] attrs={"String_Node_Str"};
  levelDefs[0]=new LevelDefinition("String_Node_Str",new String[]{"String_Node_Str"},null);
  levelDefs[1]=new LevelDefinition("String_Node_Str",new String[]{"String_Node_Str"},null);
  levelDefs[2]=new LevelDefinition("String_Node_Str",new String[]{"String_Node_Str"},attrs);
  IDimension dimension=DimensionFactory.createDimension("String_Node_Str",documentManager,new ThreeLevelDataset(),levelDefs,false);
  IHierarchy hierarchy=dimension.getHierarchy();
  assertEquals(hierarchy.getName(),"String_Node_Str");
  ILevel[] level=hierarchy.getLevels();
  Dimension realDimension=(Dimension)dimension;
  for (int i=0; i < ThreeLevelDataset.Level1Col.length; i++) {
    IndexKey indexKey=realDimension.findFirst((Level)level[0],new Object[]{ThreeLevelDataset.Level1Col[i]});
    Member levelMember=realDimension.getRowByPosition(indexKey.dimensionPos).getMembers()[0];
    assertEquals(levelMember.getKeyValues()[0],ThreeLevelDataset.Level1Col[i]);
    assertTrue(levelMember.getAttributes() == null);
    levelMember=realDimension.getDimensionRowByOffset(indexKey.offset).getMembers()[0];
    assertEquals(levelMember.getKeyValues()[0],ThreeLevelDataset.Level1Col[i]);
    indexKey=realDimension.findFirst((Level)level[1],new Object[]{ThreeLevelDataset.Level2Col[i]});
    assertEquals(indexKey.key[0],ThreeLevelDataset.Level2Col[i]);
    levelMember=realDimension.getRowByPosition(indexKey.dimensionPos).getMembers()[1];
    assertEquals(levelMember.getKeyValues()[0],ThreeLevelDataset.Level2Col[i]);
    assertTrue(levelMember.getAttributes() == null);
    levelMember=realDimension.getDimensionRowByOffset(indexKey.offset).getMembers()[1];
    assertEquals(levelMember.getKeyValues()[0],ThreeLevelDataset.Level2Col[i]);
    assertTrue(levelMember.getAttributes() == null);
    indexKey=realDimension.findFirst((Level)level[2],new Object[]{ThreeLevelDataset.Level3Col[i]});
    assertEquals(indexKey.key[0],ThreeLevelDataset.Level3Col[i]);
    assertEquals(indexKey.dimensionPos,i);
    levelMember=realDimension.getRowByPosition(indexKey.dimensionPos).getMembers()[2];
    assertEquals(levelMember.getKeyValues()[0],ThreeLevelDataset.Level3Col[i]);
    assertEquals(levelMember.getAttributes().length,1);
    assertEquals(levelMember.getAttributes()[0],new Integer(ThreeLevelDataset.Level3AttributeCol[i]));
    levelMember=realDimension.getDimensionRowByOffset(indexKey.offset).getMembers()[2];
    assertEquals(levelMember.getKeyValues()[0],ThreeLevelDataset.Level3Col[i]);
    assertEquals(levelMember.getAttributes().length,1);
    assertEquals(levelMember.getAttributes()[0],new Integer(ThreeLevelDataset.Level3AttributeCol[i]));
  }
}

Fixed version (ground truth):
private void testDimensionCreate3(IDocumentManager documentManager) throws IOException, BirtException, DataException {
  ILevelDefn[] levelDefs=new ILevelDefn[3];
  String[] attrs={"String_Node_Str"};
  levelDefs[0]=new LevelDefinition("String_Node_Str",new String[]{"String_Node_Str"},null);
  levelDefs[1]=new LevelDefinition("String_Node_Str",new String[]{"String_Node_Str"},null);
  levelDefs[2]=new LevelDefinition("String_Node_Str",new String[]{"String_Node_Str"},attrs);
  IDimension dimension=DimensionFactory.createDimension("String_Node_Str",documentManager,new ThreeLevelDataset(),levelDefs,false);
  IHierarchy hierarchy=dimension.getHierarchy();
  assertEquals(hierarchy.getName(),"String_Node_Str");
  ILevel[] level=hierarchy.getLevels();
  Dimension realDimension=(Dimension)dimension;
  for (int i=0; i < ThreeLevelDataset.Level1Col.length; i++) {
    IndexKey indexKey=realDimension.findFirst((Level)level[0],new Object[]{ThreeLevelDataset.Level1Col[i]});
    Member levelMember=realDimension.getRowByPosition(indexKey.getDimensionPos()).getMembers()[0];
    assertEquals(levelMember.getKeyValues()[0],ThreeLevelDataset.Level1Col[i]);
    assertTrue(levelMember.getAttributes() == null);
    levelMember=realDimension.getDimensionRowByOffset(indexKey.getOffset()).getMembers()[0];
    assertEquals(levelMember.getKeyValues()[0],ThreeLevelDataset.Level1Col[i]);
    indexKey=realDimension.findFirst((Level)level[1],new Object[]{ThreeLevelDataset.Level2Col[i]});
    assertEquals(indexKey.getKey()[0],ThreeLevelDataset.Level2Col[i]);
    levelMember=realDimension.getRowByPosition(indexKey.getDimensionPos()).getMembers()[1];
    assertEquals(levelMember.getKeyValues()[0],ThreeLevelDataset.Level2Col[i]);
    assertTrue(levelMember.getAttributes() == null);
    levelMember=realDimension.getDimensionRowByOffset(indexKey.getOffset()).getMembers()[1];
    assertEquals(levelMember.getKeyValues()[0],ThreeLevelDataset.Level2Col[i]);
    assertTrue(levelMember.getAttributes() == null);
    indexKey=realDimension.findFirst((Level)level[2],new Object[]{ThreeLevelDataset.Level3Col[i]});
    assertEquals(indexKey.getKey()[0],ThreeLevelDataset.Level3Col[i]);
    assertEquals(indexKey.getDimensionPos(),i);
    levelMember=realDimension.getRowByPosition(indexKey.getDimensionPos()).getMembers()[2];
    assertEquals(levelMember.getKeyValues()[0],ThreeLevelDataset.Level3Col[i]);
    assertEquals(levelMember.getAttributes().length,1);
    assertEquals(levelMember.getAttributes()[0],new Integer(ThreeLevelDataset.Level3AttributeCol[i]));
    levelMember=realDimension.getDimensionRowByOffset(indexKey.getOffset()).getMembers()[2];
    assertEquals(levelMember.getKeyValues()[0],ThreeLevelDataset.Level3Col[i]);
    assertEquals(levelMember.getAttributes().length,1);
    assertEquals(levelMember.getAttributes()[0],new Integer(ThreeLevelDataset.Level3AttributeCol[i]));
  }
}