Program: 92578
Project: 92578
Buggy source:
@SuppressWarnings("String_Node_Str") protected void indexExperiment(boolean waitForCompletion,final int index,final TmfTimeRange timeRange){
synchronized (fCheckpoints) {
    if (fIndexing) {
      return;
    }
    fIndexing=true;
  }
  final Job job=new Job("String_Node_Str" + getName() + "String_Node_Str"){
    @Override protected IStatus run(    IProgressMonitor monitor){
      while (!monitor.isCanceled()) {
        try {
          Thread.sleep(100);
        }
 catch (        InterruptedException e) {
          return Status.OK_STATUS;
        }
      }
      monitor.done();
      return Status.OK_STATUS;
    }
  }
;
  job.schedule();
  ITmfEventRequest<ITmfEvent> request=new TmfEventRequest<ITmfEvent>(ITmfEvent.class,timeRange,index,TmfDataRequest.ALL_DATA,fIndexPageSize,ITmfDataRequest.ExecutionType.BACKGROUND){
    ITmfTimestamp startTime=(fTimeRange == TmfTimeRange.Null) ? null : fTimeRange.getStartTime();
    ITmfTimestamp lastTime=(fTimeRange == TmfTimeRange.Null) ? null : fTimeRange.getEndTime();
    long initialNbEvents=fNbEvents;
    @Override public void handleStarted(){
      super.handleStarted();
    }
    @Override public void handleData(    ITmfEvent event){
      super.handleData(event);
      if (event != null) {
        ITmfTimestamp ts=event.getTimestamp();
        if (startTime == null)         startTime=ts.clone();
        lastTime=ts.clone();
        if ((getNbRead() % fIndexPageSize) == 1 && getNbRead() != 1) {
          updateExperiment();
        }
      }
    }
    @Override public void handleSuccess(){
      if (getRange() != TmfTimeRange.Eternity) {
        lastTime=getRange().getEndTime();
      }
      updateExperiment();
      super.handleSuccess();
    }
    @Override public void handleCompleted(){
      job.cancel();
      super.handleCompleted();
synchronized (fCheckpoints) {
        fIndexing=false;
        if (fIndexingPendingRange != TmfTimeRange.Null) {
          indexExperiment(false,(int)fNbEvents,fIndexingPendingRange);
          fIndexingPendingRange=TmfTimeRange.Null;
        }
      }
    }
    private void updateExperiment(){
      int nbRead=getNbRead();
      if (startTime != null) {
        fTimeRange=new TmfTimeRange(startTime,lastTime.clone());
      }
      if (nbRead != 0) {
        fNbEvents=initialNbEvents + nbRead;
        notifyListeners();
      }
    }
  }
;
  sendRequest((ITmfDataRequest<T>)request);
  if (waitForCompletion)   try {
    request.waitForCompletion();
  }
 catch (  InterruptedException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") protected void indexExperiment(boolean waitForCompletion,final int index,final TmfTimeRange timeRange){
synchronized (fCheckpoints) {
    if (fIndexing) {
      return;
    }
    fIndexing=true;
  }
  final Job job=new Job("String_Node_Str" + getName() + "String_Node_Str"){
    @Override protected IStatus run(    IProgressMonitor monitor){
      while (!monitor.isCanceled()) {
        try {
          Thread.sleep(100);
        }
 catch (        InterruptedException e) {
          return Status.OK_STATUS;
        }
      }
      monitor.done();
      return Status.OK_STATUS;
    }
  }
;
  job.schedule();
  ITmfEventRequest<ITmfEvent> request=new TmfEventRequest<ITmfEvent>(ITmfEvent.class,timeRange,index,TmfDataRequest.ALL_DATA,fIndexPageSize,ITmfDataRequest.ExecutionType.BACKGROUND){
    ITmfTimestamp startTime=(fTimeRange == TmfTimeRange.Null) ? null : fTimeRange.getStartTime();
    ITmfTimestamp lastTime=(fTimeRange == TmfTimeRange.Null) ? null : fTimeRange.getEndTime();
    long initialNbEvents=fNbEvents;
    @Override public void handleStarted(){
      super.handleStarted();
    }
    @Override public void handleData(    ITmfEvent event){
      super.handleData(event);
      if (event != null) {
        ITmfTimestamp ts=event.getTimestamp();
        if (startTime == null)         startTime=ts.clone();
        lastTime=ts.clone();
        if ((getNbRead() % fIndexPageSize) == 1 && getNbRead() != 1) {
          updateExperiment();
        }
      }
    }
    @Override public void handleSuccess(){
      if (getRange().getEndTime() != TmfTimestamp.BigCrunch) {
        lastTime=getRange().getEndTime();
      }
      updateExperiment();
      super.handleSuccess();
    }
    @Override public void handleCompleted(){
      job.cancel();
      super.handleCompleted();
synchronized (fCheckpoints) {
        fIndexing=false;
        if (fIndexingPendingRange != TmfTimeRange.Null) {
          indexExperiment(false,(int)fNbEvents,fIndexingPendingRange);
          fIndexingPendingRange=TmfTimeRange.Null;
        }
      }
    }
    private void updateExperiment(){
      int nbRead=getNbRead();
      if (startTime != null) {
        fTimeRange=new TmfTimeRange(startTime,lastTime.clone());
      }
      if (nbRead != 0) {
        fNbEvents=initialNbEvents + nbRead;
        notifyListeners();
      }
    }
  }
;
  sendRequest((ITmfDataRequest<T>)request);
  if (waitForCompletion)   try {
    request.waitForCompletion();
  }
 catch (  InterruptedException e) {
    e.printStackTrace();
  }
}