Program: 75822
Project: 75822
Buggy source:
public void testDiskIndexString4() throws IOException, DataException {
  int keyNumber=100000;
  BufferedStructureArray keyList=new BufferedStructureArray(IndexKey.getCreator(),keyNumber);
  IndexKey key=null;
  for (int i=1; i < keyNumber; i++) {
    key=new IndexKey();
    key.setKey(new Object[]{"String_Node_Str" + new Integer(i).toString()});
    key.setDimensionPos(i);
    key.setOffset(i * 4);
    keyList.add(key);
  }
  System.out.println("String_Node_Str" + System.currentTimeMillis() / 100);
  DiskIndex indexTree=DiskIndex.createIndex(DocumentManagerFactory.createFileDocumentManager(),"String_Node_Str",3,keyList,false);
  System.out.println("String_Node_Str" + System.currentTimeMillis() / 100);
  Object[][] selectedObjs1={{"String_Node_Str" + new Integer(0).toString()},{"String_Node_Str" + new Integer(100).toString()},{"String_Node_Str" + new Integer(101).toString()},{"String_Node_Str" + new Integer(102).toString()},{"String_Node_Str" + new Integer(110).toString()},{"String_Node_Str" + new Integer(121).toString()},{"String_Node_Str" + new Integer(122).toString()},{"String_Node_Str" + new Integer(134).toString()}};
  Object[][] selectedObjs2={{"String_Node_Str" + new Integer(9999).toString()},{"String_Node_Str" + new Integer(99999).toString()},{"String_Node_Str" + new Integer(999999).toString()}};
  int[] resultObjs1={100,101,102,110,121,122,134};
  int[] resultObjs2={9999,99999};
  ISelection[] selections=new ISelection[5];
  selections[0]=SelectionFactory.createMutiRowSelection(selectedObjs1);
  selections[1]=SelectionFactory.createRangeSelection(new Object[]{"String_Node_Str" + new Integer(20000).toString()},new Object[]{"String_Node_Str" + new Integer(20100).toString()},true,true);
  selections[2]=SelectionFactory.createRangeSelection(new Object[]{"String_Node_Str" + new Integer(30000).toString()},new Object[]{"String_Node_Str" + new Integer(30900).toString()},false,true);
  selections[3]=SelectionFactory.createRangeSelection(new Object[]{"String_Node_Str" + new Integer(40000).toString()},new Object[]{"String_Node_Str" + new Integer(42001).toString()},true,false);
  selections[4]=SelectionFactory.createMutiRowSelection(selectedObjs2);
  System.out.println("String_Node_Str" + System.currentTimeMillis() / 100);
  IDiskArray list=null;
  for (int i=0; i < 1; i++) {
    list=indexTree.find(selections);
  }
  System.out.println("String_Node_Str" + System.currentTimeMillis() / 100);
  assertEquals(list.size(),3343);
  for (int i=0; i < resultObjs1.length; i++) {
    key=(IndexKey)list.get(i);
    assertEquals(key.getKey()[0],"String_Node_Str" + new Integer(resultObjs1[i]).toString());
    assertEquals(key.getDimensionPos(),resultObjs1[i]);
    assertEquals(key.getOffset(),(resultObjs1[i]) * 4);
  }
  for (int i=0; i < 101; i++) {
    key=(IndexKey)list.get(resultObjs1.length + i);
    assertEquals(key.getDimensionPos(),new Integer(key.getKey()[0].toString().substring(15)).intValue());
    assertEquals(key.getOffset(),(new Integer(key.getKey()[0].toString().substring(15)).intValue()) * 4);
  }
  for (int i=0; i < resultObjs2.length; i++) {
    key=(IndexKey)list.get(list.size() - resultObjs2.length + i);
    assertEquals(key.getKey()[0],"String_Node_Str" + new Integer(resultObjs2[i]).toString());
    assertEquals(key.getDimensionPos(),resultObjs2[i]);
    assertEquals(key.getOffset(),(resultObjs2[i]) * 4);
  }
}

Fixed version (ground truth):
public void testDiskIndexString4() throws IOException, DataException {
  int keyNumber=100000;
  BufferedStructureArray keyList=new BufferedStructureArray(IndexKey.getCreator(),4000);
  IndexKey key=null;
  for (int i=1; i < keyNumber; i++) {
    key=new IndexKey();
    key.setKey(new Object[]{"String_Node_Str" + new Integer(i).toString()});
    key.setDimensionPos(i);
    key.setOffset(i * 4);
    keyList.add(key);
  }
  System.out.println("String_Node_Str" + System.currentTimeMillis() / 100);
  DiskIndex indexTree=DiskIndex.createIndex(DocumentManagerFactory.createFileDocumentManager(),"String_Node_Str",3,keyList,false);
  System.out.println("String_Node_Str" + System.currentTimeMillis() / 100);
  Object[][] selectedObjs1={{"String_Node_Str" + new Integer(0).toString()},{"String_Node_Str" + new Integer(100).toString()},{"String_Node_Str" + new Integer(101).toString()},{"String_Node_Str" + new Integer(102).toString()},{"String_Node_Str" + new Integer(110).toString()},{"String_Node_Str" + new Integer(121).toString()},{"String_Node_Str" + new Integer(122).toString()},{"String_Node_Str" + new Integer(134).toString()}};
  Object[][] selectedObjs2={{"String_Node_Str" + new Integer(9999).toString()},{"String_Node_Str" + new Integer(99999).toString()},{"String_Node_Str" + new Integer(999999).toString()}};
  int[] resultObjs1={100,101,102,110,121,122,134};
  int[] resultObjs2={9999,99999};
  ISelection[] selections=new ISelection[5];
  selections[0]=SelectionFactory.createMutiRowSelection(selectedObjs1);
  selections[1]=SelectionFactory.createRangeSelection(new Object[]{"String_Node_Str" + new Integer(20000).toString()},new Object[]{"String_Node_Str" + new Integer(20100).toString()},true,true);
  selections[2]=SelectionFactory.createRangeSelection(new Object[]{"String_Node_Str" + new Integer(30000).toString()},new Object[]{"String_Node_Str" + new Integer(30900).toString()},false,true);
  selections[3]=SelectionFactory.createRangeSelection(new Object[]{"String_Node_Str" + new Integer(40000).toString()},new Object[]{"String_Node_Str" + new Integer(42001).toString()},true,false);
  selections[4]=SelectionFactory.createMutiRowSelection(selectedObjs2);
  System.out.println("String_Node_Str" + System.currentTimeMillis() / 100);
  IDiskArray list=null;
  for (int i=0; i < 1; i++) {
    list=indexTree.find(selections);
  }
  System.out.println("String_Node_Str" + System.currentTimeMillis() / 100);
  assertEquals(list.size(),3343);
  for (int i=0; i < resultObjs1.length; i++) {
    key=(IndexKey)list.get(i);
    assertEquals(key.getKey()[0],"String_Node_Str" + new Integer(resultObjs1[i]).toString());
    assertEquals(key.getDimensionPos(),resultObjs1[i]);
    assertEquals(key.getOffset(),(resultObjs1[i]) * 4);
  }
  for (int i=0; i < 101; i++) {
    key=(IndexKey)list.get(resultObjs1.length + i);
    assertEquals(key.getDimensionPos(),new Integer(key.getKey()[0].toString().substring(15)).intValue());
    assertEquals(key.getOffset(),(new Integer(key.getKey()[0].toString().substring(15)).intValue()) * 4);
  }
  for (int i=0; i < resultObjs2.length; i++) {
    key=(IndexKey)list.get(list.size() - resultObjs2.length + i);
    assertEquals(key.getKey()[0],"String_Node_Str" + new Integer(resultObjs2[i]).toString());
    assertEquals(key.getDimensionPos(),resultObjs2[i]);
    assertEquals(key.getOffset(),(resultObjs2[i]) * 4);
  }
}