Program: 76058
Project: 76058
Buggy source:
private void testDimensionCreateAndFind1(IDocumentManager documentManager) throws IOException, BirtException, DataException {
  int memeberCount=10000;
  ILevelDefn[] levelDefs=new ILevelDefn[1];
  levelDefs[0]=new LevelDefinition("String_Node_Str",new String[]{"String_Node_Str"},null);
  String[] levelNames=new String[1];
  levelNames[0]="String_Node_Str";
  DimensionForTest iterator=new DimensionForTest(levelNames);
  String[] IDs=new String[memeberCount];
  for (int i=0; i < memeberCount; i++) {
    IDs[i]=String.valueOf(i);
  }
  Arrays.sort(IDs);
  iterator.setLevelMember(0,IDs);
  IDimension dimension=DimensionFactory.createDimension("String_Node_Str",documentManager,iterator,levelDefs,false);
  IHierarchy hierarchy=dimension.getHierarchy();
  assertEquals(hierarchy.getName(),"String_Node_Str");
  ILevel[] level=hierarchy.getLevels();
  assertEquals(level[0].getName(),"String_Node_Str");
  Dimension realDimension=(Dimension)dimension;
  for (int i=0; i < memeberCount; i++) {
    IndexKey indexKey=realDimension.findFirst((Level)level[0],new Object[]{IDs[i]});
    assertEquals(indexKey.key[0],IDs[i]);
    assertEquals(indexKey.dimensionPos,i);
    Member levelMember=realDimension.getRowByPosition(indexKey.dimensionPos).getMembers()[0];
    assertEquals(levelMember.getKeyValues()[0],IDs[i]);
    levelMember=realDimension.getDimensionRowByOffset(indexKey.offset).getMembers()[0];
    assertEquals(levelMember.getKeyValues()[0],IDs[i]);
  }
  dimension=DimensionFactory.loadDimension("String_Node_Str",documentManager);
  hierarchy=dimension.getHierarchy();
  assertEquals(hierarchy.getName(),"String_Node_Str");
  level=hierarchy.getLevels();
  assertEquals(level[0].getName(),"String_Node_Str");
  realDimension=(Dimension)dimension;
  for (int i=0; i < memeberCount; i++) {
    IndexKey indexKey=realDimension.findFirst((Level)level[0],new Object[]{IDs[i]});
    assertEquals(indexKey.key[0],IDs[i]);
    assertEquals(indexKey.dimensionPos,i);
    Member levelMember=realDimension.getRowByPosition(indexKey.dimensionPos).getMembers()[0];
    assertEquals(levelMember.getKeyValues()[0],IDs[i]);
    levelMember=realDimension.getDimensionRowByOffset(indexKey.offset).getMembers()[0];
    assertEquals(levelMember.getKeyValues()[0],IDs[i]);
  }
}

Fixed version (ground truth):
private void testDimensionCreateAndFind1(IDocumentManager documentManager) throws IOException, BirtException, DataException {
  int memeberCount=10000;
  ILevelDefn[] levelDefs=new ILevelDefn[1];
  levelDefs[0]=new LevelDefinition("String_Node_Str",new String[]{"String_Node_Str"},null);
  String[] levelNames=new String[1];
  levelNames[0]="String_Node_Str";
  DimensionForTest iterator=new DimensionForTest(levelNames);
  String[] IDs=new String[memeberCount];
  for (int i=0; i < memeberCount; i++) {
    IDs[i]=String.valueOf(i);
  }
  Arrays.sort(IDs);
  iterator.setLevelMember(0,IDs);
  IDimension dimension=DimensionFactory.createDimension("String_Node_Str",documentManager,iterator,levelDefs,false);
  IHierarchy hierarchy=dimension.getHierarchy();
  assertEquals(hierarchy.getName(),"String_Node_Str");
  ILevel[] level=hierarchy.getLevels();
  assertEquals(level[0].getName(),"String_Node_Str");
  Dimension realDimension=(Dimension)dimension;
  for (int i=0; i < memeberCount; i++) {
    IndexKey indexKey=realDimension.findFirst((Level)level[0],new Object[]{IDs[i]});
    assertEquals(indexKey.getKey()[0],IDs[i]);
    assertEquals(indexKey.getDimensionPos(),i);
    Member levelMember=realDimension.getRowByPosition(indexKey.getDimensionPos()).getMembers()[0];
    assertEquals(levelMember.getKeyValues()[0],IDs[i]);
    levelMember=realDimension.getDimensionRowByOffset(indexKey.getOffset()).getMembers()[0];
    assertEquals(levelMember.getKeyValues()[0],IDs[i]);
  }
  dimension=DimensionFactory.loadDimension("String_Node_Str",documentManager);
  hierarchy=dimension.getHierarchy();
  assertEquals(hierarchy.getName(),"String_Node_Str");
  level=hierarchy.getLevels();
  assertEquals(level[0].getName(),"String_Node_Str");
  realDimension=(Dimension)dimension;
  for (int i=0; i < memeberCount; i++) {
    IndexKey indexKey=realDimension.findFirst((Level)level[0],new Object[]{IDs[i]});
    assertEquals(indexKey.getKey()[0],IDs[i]);
    assertEquals(indexKey.getDimensionPos(),i);
    Member levelMember=realDimension.getRowByPosition(indexKey.getDimensionPos()).getMembers()[0];
    assertEquals(levelMember.getKeyValues()[0],IDs[i]);
    levelMember=realDimension.getDimensionRowByOffset(indexKey.getOffset()).getMembers()[0];
    assertEquals(levelMember.getKeyValues()[0],IDs[i]);
  }
}