Program: 92325
Project: 92325
Buggy source:
@SuppressWarnings("String_Node_Str") public synchronized int getFilteredEventIndex(final long rank){
  int current;
  int startRank;
  TmfDataRequest<ITmfEvent> request;
synchronized (this) {
    int start=0;
    int end=fFilterIndex.size();
    if ((fCacheEndIndex - fCacheStartIndex) > 1) {
      if (rank < fCache[0].rank) {
        end=(fCacheStartIndex / fCache.length) + 1;
      }
 else       if (rank > fCache[fCacheEndIndex - fCacheStartIndex - 1].rank) {
        start=fCacheEndIndex / fCache.length;
      }
 else {
        for (int i=0; i < (fCacheEndIndex - fCacheStartIndex); i++) {
          if (fCache[i].rank >= rank) {
            return fCacheStartIndex + i;
          }
        }
        return fCacheEndIndex;
      }
    }
    current=(start + end) / 2;
    while (current != start) {
      if (rank < fFilterIndex.get(current)) {
        end=current;
        current=(start + end) / 2;
      }
 else {
        start=current;
        current=(start + end) / 2;
      }
    }
    startRank=fFilterIndex.get(current);
  }
  final int index=current * fCache.length;
class DataRequest<T extends ITmfEvent> extends TmfDataRequest<T> {
    int fRank;
    int fIndex;
    DataRequest(    Class<T> dataType,    int start,    int nbRequested){
      super(dataType,start,nbRequested);
      fRank=start;
      fIndex=index;
    }
    @Override public void handleData(    T event){
      super.handleData(event);
      if (isCancelled()) {
        return;
      }
      if (fRank >= rank) {
        cancel();
        return;
      }
      fRank++;
      if (fFilter.matches(event)) {
        fIndex++;
      }
    }
    public int getFilteredIndex(){
      return fIndex;
    }
  }
  request=new DataRequest<ITmfEvent>(ITmfEvent.class,startRank,TmfDataRequest.ALL_DATA);
  ((ITmfDataProvider<ITmfEvent>)fTrace).sendRequest(request);
  try {
    request.waitForCompletion();
    return ((DataRequest<ITmfEvent>)request).getFilteredIndex();
  }
 catch (  InterruptedException e) {
    Activator.getDefault().logError("String_Node_Str",e);
  }
  return 0;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public int getFilteredEventIndex(final long rank){
  int current;
  int startRank;
  TmfDataRequest<ITmfEvent> request;
  final ITmfFilter filter=fFilter;
synchronized (this) {
    int start=0;
    int end=fFilterIndex.size();
    if ((fCacheEndIndex - fCacheStartIndex) > 1) {
      if (rank < fCache[0].rank) {
        end=(fCacheStartIndex / fCache.length) + 1;
      }
 else       if (rank > fCache[fCacheEndIndex - fCacheStartIndex - 1].rank) {
        start=fCacheEndIndex / fCache.length;
      }
 else {
        for (int i=0; i < (fCacheEndIndex - fCacheStartIndex); i++) {
          if (fCache[i].rank >= rank) {
            return fCacheStartIndex + i;
          }
        }
        return fCacheEndIndex;
      }
    }
    current=(start + end) / 2;
    while (current != start) {
      if (rank < fFilterIndex.get(current)) {
        end=current;
        current=(start + end) / 2;
      }
 else {
        start=current;
        current=(start + end) / 2;
      }
    }
    startRank=fFilterIndex.size() > 0 ? fFilterIndex.get(current) : 0;
  }
  final int index=current * fCache.length;
class DataRequest<T extends ITmfEvent> extends TmfDataRequest<T> {
    ITmfFilter fFilter;
    int fRank;
    int fIndex;
    DataRequest(    Class<T> dataType,    ITmfFilter filter,    int start,    int nbRequested){
      super(dataType,start,nbRequested);
      fFilter=filter;
      fRank=start;
      fIndex=index;
    }
    @Override public void handleData(    T event){
      super.handleData(event);
      if (isCancelled()) {
        return;
      }
      if (fRank >= rank) {
        cancel();
        return;
      }
      fRank++;
      if (fFilter.matches(event)) {
        fIndex++;
      }
    }
    public int getFilteredIndex(){
      return fIndex;
    }
  }
  request=new DataRequest<ITmfEvent>(ITmfEvent.class,filter,startRank,TmfDataRequest.ALL_DATA);
  ((ITmfDataProvider<ITmfEvent>)fTrace).sendRequest(request);
  try {
    request.waitForCompletion();
    return ((DataRequest<ITmfEvent>)request).getFilteredIndex();
  }
 catch (  InterruptedException e) {
    Activator.getDefault().logError("String_Node_Str",e);
  }
  return 0;
}