Program: 76252
Project: 76252
Buggy source:
private void testDimensionIterator(IDocumentManager documentManager) throws IOException, BirtException, DataException {
  Dimension dimension=createDimension(documentManager);
  ILevel[] level=dimension.getHierarchy().getLevels();
  ISelection[][] filter=new ISelection[1][1];
  filter[0][0]=SelectionFactory.createRangeSelection(new Object[]{new Integer(1)},new Object[]{new Integer(2)},true,false);
  Level[] findLevel=new Level[1];
  findLevel[0]=(Level)level[1];
  IDiskArray positionArray=dimension.find(findLevel,filter);
  assertEquals(positionArray.size(),4);
  String[] levelNames=new String[1];
  levelNames[0]="String_Node_Str";
  DimensionResultIterator dimesionResultSet=new DimensionResultIterator(dimension,positionArray,levelNames);
  assertEquals(dimesionResultSet.getLevelIndex("String_Node_Str"),1);
  assertEquals(dimesionResultSet.getLevelIndex("String_Node_Str"),0);
  assertEquals(dimesionResultSet.getLevelKeyDataType("String_Node_Str")[0],DataType.INTEGER_TYPE);
  assertEquals(dimesionResultSet.getLevelKeyDataType("String_Node_Str")[0],DataType.INTEGER_TYPE);
  assertEquals(dimesionResultSet.length(),4);
  dimesionResultSet.seek(0);
  assertEquals(dimesionResultSet.getLevelKeyValue(0)[0],new Integer(1));
  assertEquals(dimesionResultSet.getLevelKeyValue(1)[0],new Integer(1));
  assertEquals(dimesionResultSet.getLevelKeyValue(2)[0],new Integer(1));
  dimesionResultSet.seek(1);
  assertEquals(dimesionResultSet.getLevelKeyValue(0)[0],new Integer(1));
  assertEquals(dimesionResultSet.getLevelKeyValue(1)[0],new Integer(1));
  assertEquals(dimesionResultSet.getLevelKeyValue(2)[0],new Integer(2));
  dimesionResultSet.seek(2);
  assertEquals(dimesionResultSet.getLevelKeyValue(0)[0],new Integer(2));
  assertEquals(dimesionResultSet.getLevelKeyValue(1)[0],new Integer(1));
  assertEquals(dimesionResultSet.getLevelKeyValue(2)[0],new Integer(1));
  dimesionResultSet.seek(3);
  assertEquals(dimesionResultSet.getLevelKeyValue(0)[0],new Integer(2));
  assertEquals(dimesionResultSet.getLevelKeyValue(1)[0],new Integer(1));
  assertEquals(dimesionResultSet.getLevelKeyValue(2)[0],new Integer(2));
}

Fixed version (ground truth):
private void testDimensionIterator(IDocumentManager documentManager) throws IOException, BirtException, DataException {
  Dimension dimension=createDimension(documentManager);
  ILevel[] level=dimension.getHierarchy().getLevels();
  ISelection[][] filter=new ISelection[1][1];
  filter[0][0]=SelectionFactory.createRangeSelection(new Object[]{new Integer(1)},new Object[]{new Integer(2)},true,false);
  Level[] findLevel=new Level[1];
  findLevel[0]=(Level)level[1];
  IDiskArray positionArray=dimension.find(findLevel,filter);
  assertEquals(positionArray.size(),4);
  String[] levelNames=new String[1];
  levelNames[0]="String_Node_Str";
  DimensionResultIterator dimesionResultSet=new DimensionResultIterator(dimension,positionArray,levelNames);
  assertEquals(dimesionResultSet.getLevelIndex("String_Node_Str"),1);
  assertEquals(dimesionResultSet.getLevelIndex("String_Node_Str"),0);
  assertEquals(dimesionResultSet.getLevelKeyDataType("String_Node_Str")[0],DataType.INTEGER_TYPE);
  assertEquals(dimesionResultSet.getLevelKeyDataType("String_Node_Str")[0],DataType.INTEGER_TYPE);
  assertEquals(dimesionResultSet.length(),4);
  dimesionResultSet.seek(0);
  assertEquals(dimesionResultSet.getLevelKeyValue(0)[0],new Integer(1));
  assertEquals(dimesionResultSet.getLevelKeyValue(1)[0],new Integer(1));
  assertEquals(dimesionResultSet.getLevelKeyValue(2)[0],new Integer(1));
  dimesionResultSet.seek(1);
  assertEquals(dimesionResultSet.getLevelKeyValue(0)[0],new Integer(1));
  assertEquals(dimesionResultSet.getLevelKeyValue(1)[0],new Integer(1));
  assertEquals(dimesionResultSet.getLevelKeyValue(2)[0],new Integer(2));
  dimesionResultSet.seek(2);
  assertEquals(dimesionResultSet.getLevelKeyValue(0)[0],new Integer(2));
  assertEquals(dimesionResultSet.getLevelKeyValue(1)[0],new Integer(1));
  assertEquals(dimesionResultSet.getLevelKeyValue(2)[0],new Integer(5));
  dimesionResultSet.seek(3);
  assertEquals(dimesionResultSet.getLevelKeyValue(0)[0],new Integer(2));
  assertEquals(dimesionResultSet.getLevelKeyValue(1)[0],new Integer(1));
  assertEquals(dimesionResultSet.getLevelKeyValue(2)[0],new Integer(6));
}