Program: 92715
Project: 92715
Buggy source:
private ITmfDataRequest<LttngEvent> buildCheckPoints(final TmfExperiment<LttngEvent> experiment,final TmfTimeRange range,boolean initial){
  if (experiment == null) {
    TraceDebug.debug("String_Node_Str");
    return null;
  }
  LTTngTreeNode experimentNode=getChildByName(experiment.getName());
  if (experimentNode == null) {
    TraceDebug.debug("String_Node_Str" + experiment.getName() + "String_Node_Str");
    return null;
  }
  final boolean waitForCompletion=fwaitForCompletion;
  LTTngTreeNode[] traceNodes=experimentNode.getChildren();
  if (initial) {
synchronized (this) {
      ftraceToManagerMap.clear();
    }
    ITmfTrace trace;
    for (    LTTngTreeNode traceStateManagerNode : traceNodes) {
      IStateTraceManager traceManager;
      try {
        traceManager=(IStateTraceManager)traceStateManagerNode;
      }
 catch (      ClassCastException e) {
        System.out.println(e.getStackTrace().toString());
        return null;
      }
      traceManager.clearCheckPoints();
      trace=traceManager.getStateTrace();
synchronized (this) {
        ftraceToManagerMap.put(trace,new StateTraceHelper(traceManager));
      }
    }
  }
  if (ftraceToManagerMap.size() < 1) {
    TraceDebug.debug("String_Node_Str" + experiment.getName());
    return null;
  }
  fCheckPointNbEventsHandled=0;
  ITmfEventRequest<LttngEvent> request=new TmfEventRequest<LttngEvent>(LttngEvent.class,range,fCheckPointUpdateIndex,TmfEventRequest.ALL_DATA,LttngConstants.DEFAULT_BLOCK_SIZE,ITmfDataRequest.ExecutionType.BACKGROUND){
    @Override public void handleData(    LttngEvent event){
      super.handleData(event);
      if (event != null) {
        fCheckPointNbEventsHandled++;
        ITmfTrace trace=event.getTrace();
        StateTraceHelper helper=ftraceToManagerMap.get(trace);
        if (helper != null) {
          helper.incrementNumberRead();
          LttngSyntheticEvent synEvent=updateSynEvent(event,helper.getTraceModel());
          helper.getStateManager().handleEvent(synEvent,helper.getNumberRead());
        }
 else {
          TraceDebug.debug("String_Node_Str" + trace.getName());
        }
      }
    }
    @Override public void handleCompleted(){
      super.handleCompleted();
      printCompletedMessage();
      if (!waitForCompletion) {
synchronized (fCheckPointUpdateSyncObj) {
          fCheckPointUpdateBusy=false;
          fCheckPointUpdateIndex+=fCheckPointNbEventsHandled;
          if (fCheckPointUpdatePending) {
            fCheckPointUpdatePending=false;
            fCheckPointUpdateBusy=true;
            buildCheckPoints(experiment,fCheckPointUpdateRange,false);
          }
        }
      }
    }
    private void printCompletedMessage(){
      if (TraceDebug.isDEBUG()) {
        TraceDebug.debug("String_Node_Str" + fCheckPointNbEventsHandled + "String_Node_Str");
        for (        StateTraceHelper helper : ftraceToManagerMap.values()) {
          TraceDebug.debug(helper.getStateManager().toString() + "String_Node_Str");
        }
      }
    }
  }
;
  experiment.sendRequest(request);
  if (waitForCompletion) {
    try {
      request.waitForCompletion();
synchronized (fCheckPointUpdateSyncObj) {
        fCheckPointUpdateBusy=false;
        fCheckPointUpdateIndex+=fCheckPointNbEventsHandled;
        if (fCheckPointUpdatePending) {
          fCheckPointUpdatePending=false;
          fCheckPointUpdateBusy=true;
          buildCheckPoints(experiment,fCheckPointUpdateRange,false);
        }
      }
    }
 catch (    InterruptedException e) {
      e.printStackTrace();
    }
  }
  return request;
}

Fixed version (ground truth):
private ITmfDataRequest<LttngEvent> buildCheckPoints(final TmfExperiment<LttngEvent> experiment,final TmfTimeRange range,boolean initial){
  if (experiment == null) {
    TraceDebug.debug("String_Node_Str");
    return null;
  }
  LTTngTreeNode experimentNode=getChildByName(experiment.getName());
  if (experimentNode == null) {
    TraceDebug.debug("String_Node_Str" + experiment.getName() + "String_Node_Str");
    return null;
  }
  final boolean waitForCompletion=fwaitForCompletion;
  LTTngTreeNode[] traceNodes=experimentNode.getChildren();
  if (initial) {
synchronized (this) {
      ftraceToManagerMap.clear();
    }
    ITmfTrace<?> trace;
    for (    LTTngTreeNode traceStateManagerNode : traceNodes) {
      IStateTraceManager traceManager;
      try {
        traceManager=(IStateTraceManager)traceStateManagerNode;
      }
 catch (      ClassCastException e) {
        System.out.println(e.getStackTrace().toString());
        return null;
      }
      traceManager.clearCheckPoints();
      trace=traceManager.getStateTrace();
synchronized (this) {
        ftraceToManagerMap.put(trace,new StateTraceHelper(traceManager));
      }
    }
  }
  if (ftraceToManagerMap.size() < 1) {
    TraceDebug.debug("String_Node_Str" + experiment.getName());
    return null;
  }
  fCheckPointNbEventsHandled=0;
  ITmfEventRequest<LttngEvent> request=new TmfEventRequest<LttngEvent>(LttngEvent.class,range,fCheckPointUpdateIndex,TmfEventRequest.ALL_DATA,LttngConstants.DEFAULT_BLOCK_SIZE,ITmfDataRequest.ExecutionType.BACKGROUND){
    @Override public void handleData(    LttngEvent event){
      super.handleData(event);
      if (event != null) {
        fCheckPointNbEventsHandled++;
        ITmfTrace<?> trace=event.getTrace();
        StateTraceHelper helper=ftraceToManagerMap.get(trace);
        if (helper != null) {
          helper.incrementNumberRead();
          LttngSyntheticEvent synEvent=updateSynEvent(event,helper.getTraceModel());
          helper.getStateManager().handleEvent(synEvent,helper.getNumberRead());
        }
 else {
          TraceDebug.debug("String_Node_Str" + trace.getName());
        }
      }
    }
    @Override public void handleCompleted(){
      super.handleCompleted();
      printCompletedMessage();
      if (!waitForCompletion) {
synchronized (fCheckPointUpdateSyncObj) {
          fCheckPointUpdateBusy=false;
          fCheckPointUpdateIndex+=fCheckPointNbEventsHandled;
          if (fCheckPointUpdatePending) {
            fCheckPointUpdatePending=false;
            fCheckPointUpdateBusy=true;
            buildCheckPoints(experiment,fCheckPointUpdateRange,false);
          }
        }
      }
    }
    private void printCompletedMessage(){
      if (TraceDebug.isDEBUG()) {
        TraceDebug.debug("String_Node_Str" + fCheckPointNbEventsHandled + "String_Node_Str");
        for (        StateTraceHelper helper : ftraceToManagerMap.values()) {
          TraceDebug.debug(helper.getStateManager().toString() + "String_Node_Str");
        }
      }
    }
  }
;
  experiment.sendRequest(request);
  if (waitForCompletion) {
    try {
      request.waitForCompletion();
synchronized (fCheckPointUpdateSyncObj) {
        fCheckPointUpdateBusy=false;
        fCheckPointUpdateIndex+=fCheckPointNbEventsHandled;
        if (fCheckPointUpdatePending) {
          fCheckPointUpdatePending=false;
          fCheckPointUpdateBusy=true;
          buildCheckPoints(experiment,fCheckPointUpdateRange,false);
        }
      }
    }
 catch (    InterruptedException e) {
      e.printStackTrace();
    }
  }
  return request;
}