Program: 74583
Project: 74583
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);
  DimensionResultIterator dimesionResultSet=new DimensionResultIterator(dimension,positionArray);
  dimLevel11=new DimLevel(dimension.getName(),"String_Node_Str");
  dimLevel12=new DimLevel(dimension.getName(),"String_Node_Str");
  assertEquals(dimesionResultSet.getLevelIndex(dimLevel12.getLevelName()),1);
  assertEquals(dimesionResultSet.getLevelIndex(dimLevel11.getLevelName()),0);
  assertEquals(dimesionResultSet.getLevelKeyDataType(dimLevel12.getLevelName())[0],DataType.INTEGER_TYPE);
  assertEquals(dimesionResultSet.getLevelKeyDataType(dimLevel11.getLevelName())[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));
}

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);
  DimensionResultIterator dimesionResultSet=new DimensionResultIterator(dimension,positionArray,new StopSign());
  dimLevel11=new DimLevel(dimension.getName(),"String_Node_Str");
  dimLevel12=new DimLevel(dimension.getName(),"String_Node_Str");
  assertEquals(dimesionResultSet.getLevelIndex(dimLevel12.getLevelName()),1);
  assertEquals(dimesionResultSet.getLevelIndex(dimLevel11.getLevelName()),0);
  assertEquals(dimesionResultSet.getLevelKeyDataType(dimLevel12.getLevelName())[0],DataType.INTEGER_TYPE);
  assertEquals(dimesionResultSet.getLevelKeyDataType(dimLevel11.getLevelName())[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));
}