Program: 92272
Project: 92272
Buggy source:
public void testGrowingIndex() throws Exception {
  ITmfTrace<TmfEvent>[] testTraces=new TmfTraceStub[2];
  try {
    URL location=FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(),new Path(DIRECTORY + File.separator + TEST_STREAM1),null);
    File test=new File(FileLocator.toFileURL(location).toURI());
    final TmfTraceStub trace1=new TmfTraceStub(test.getPath(),0,false);
    testTraces[0]=trace1;
    location=FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(),new Path(DIRECTORY + File.separator + TEST_STREAM2),null);
    test=new File(FileLocator.toFileURL(location).toURI());
    final TmfTraceStub trace2=new TmfTraceStub(test.getPath(),0,false);
    testTraces[1]=trace2;
  }
 catch (  final TmfTraceException e) {
    e.printStackTrace();
  }
catch (  final URISyntaxException e) {
    e.printStackTrace();
  }
catch (  final IOException e) {
    e.printStackTrace();
  }
  TmfExperimentStub<TmfEvent> experiment=new TmfExperimentStub<TmfEvent>(EXPERIMENT,testTraces,BLOCK_SIZE);
  int pageSize=experiment.getCacheSize();
  TmfTimeRange range=new TmfTimeRange(new TmfTimestamp(1,-3),new TmfTimestamp(NB_EVENTS / 2 - 1,-3));
  experiment.getIndexer().buildIndex(0,range,true);
  List<ITmfCheckpoint> checkpoints=experiment.getIndexer().getCheckpoints();
  assertTrue("String_Node_Str",checkpoints != null);
  assertEquals("String_Node_Str",NB_EVENTS / BLOCK_SIZE / 2,checkpoints.size());
  experiment.getIndexer().buildIndex(NB_EVENTS / 2,TmfTimeRange.ETERNITY,true);
  assertEquals("String_Node_Str",NB_EVENTS / BLOCK_SIZE,checkpoints.size());
  for (int i=0; i < checkpoints.size(); i++) {
    ITmfCheckpoint checkpoint=checkpoints.get(i);
    TmfExperimentLocation expLocation=(TmfExperimentLocation)checkpoint.getLocation();
    TmfLocationArray locations=expLocation.getLocation();
    ITmfContext[] trcContexts=new ITmfContext[2];
    trcContexts[0]=new TmfContext(locations.getLocations()[0],(i * pageSize) / 2);
    trcContexts[1]=new TmfContext(locations.getLocations()[1],(i * pageSize) / 2);
    TmfExperimentContext expContext=new TmfExperimentContext(trcContexts);
    expContext.getEvents()[0]=testTraces[0].getNext(testTraces[0].seekEvent((i * pageSize) / 2));
    expContext.getEvents()[1]=testTraces[1].getNext(testTraces[1].seekEvent((i * pageSize) / 2));
    ITmfEvent event=experiment.parseEvent(expContext);
    assertTrue(expContext.getRank() == i * pageSize);
    assertTrue((checkpoint.getTimestamp().compareTo(event.getTimestamp(),false) == 0));
    assertEquals("String_Node_Str",i * pageSize + 1,checkpoint.getTimestamp().getValue());
  }
}

Fixed version (ground truth):
public void testGrowingIndex() throws Exception {
  ITmfTrace<TmfEvent>[] testTraces=new TmfTraceStub[2];
  try {
    URL location=FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(),new Path(DIRECTORY + File.separator + TEST_STREAM1),null);
    File test=new File(FileLocator.toFileURL(location).toURI());
    final TmfTraceStub trace1=new TmfTraceStub(test.getPath(),0,false);
    testTraces[0]=trace1;
    location=FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(),new Path(DIRECTORY + File.separator + TEST_STREAM2),null);
    test=new File(FileLocator.toFileURL(location).toURI());
    final TmfTraceStub trace2=new TmfTraceStub(test.getPath(),0,false);
    testTraces[1]=trace2;
  }
 catch (  final TmfTraceException e) {
    e.printStackTrace();
  }
catch (  final URISyntaxException e) {
    e.printStackTrace();
  }
catch (  final IOException e) {
    e.printStackTrace();
  }
  TmfExperimentStub<TmfEvent> experiment=new TmfExperimentStub<TmfEvent>(EXPERIMENT,testTraces,BLOCK_SIZE);
  int pageSize=experiment.getCacheSize();
  TmfTimeRange range=new TmfTimeRange(new TmfTimestamp(1,-3),new TmfTimestamp(NB_EVENTS / 2 - 1,-3));
  experiment.getIndexer().buildIndex(0,range,true);
  List<ITmfCheckpoint> checkpoints=experiment.getIndexer().getCheckpoints();
  assertTrue("String_Node_Str",checkpoints != null);
  assertEquals("String_Node_Str",NB_EVENTS / BLOCK_SIZE / 2,checkpoints.size());
  experiment.getIndexer().buildIndex(NB_EVENTS / 2,TmfTimeRange.ETERNITY,true);
  assertEquals("String_Node_Str",NB_EVENTS / BLOCK_SIZE,checkpoints.size());
  for (int i=0; i < checkpoints.size(); i++) {
    ITmfCheckpoint checkpoint=checkpoints.get(i);
    TmfExperimentLocation expLocation=(TmfExperimentLocation)checkpoint.getLocation();
    TmfLocationArray locations=expLocation.getLocation();
    ITmfContext[] trcContexts=new ITmfContext[2];
    trcContexts[0]=new TmfContext(locations.getLocations()[0].getLocation(),(i * pageSize) / 2);
    trcContexts[1]=new TmfContext(locations.getLocations()[1].getLocation(),(i * pageSize) / 2);
    TmfExperimentContext expContext=new TmfExperimentContext(trcContexts);
    expContext.getEvents()[0]=testTraces[0].getNext(testTraces[0].seekEvent((i * pageSize) / 2));
    expContext.getEvents()[1]=testTraces[1].getNext(testTraces[1].seekEvent((i * pageSize) / 2));
    ITmfEvent event=experiment.parseEvent(expContext);
    assertTrue(expContext.getRank() == i * pageSize);
    assertTrue((checkpoint.getTimestamp().compareTo(event.getTimestamp(),false) == 0));
    assertEquals("String_Node_Str",i * pageSize + 1,checkpoint.getTimestamp().getValue());
  }
}