Program: 105000
Project: 105000
Buggy source:
/** 
 * Handles a change in the selected endpoint.
 * @param oldEndpoints Set of the old selected endpoints.
 * @param newEndpoints Set of the new selected endpoints.
 */
private void selectedEndpointChanged(Set<Endpoint> oldEndpoints,Set<Endpoint> newEndpoints){
  if (logger.isDebugEnabled()) {
    if (newEndpoints.isEmpty())     logger.debug("String_Node_Str");
 else {
      StringBuilder newEndpointsIDList=new StringBuilder();
      for (      Endpoint e : newEndpoints) {
        newEndpointsIDList.append(e.getID());
        newEndpointsIDList.append("String_Node_Str");
      }
      logger.debug("String_Node_Str" + newEndpointsIDList.toString());
    }
  }
  SimulcastReceiver simulcastReceiver=getSimulcastReceiver();
  if (simulcastReceiver == null) {
    logger.warn("String_Node_Str" + "String_Node_Str");
    return;
  }
  SimulcastStream[] simStreams=simulcastReceiver.getSimulcastStreams();
  if (simStreams == null || simStreams.length == 0) {
    logger.warn("String_Node_Str" + "String_Node_Str");
    return;
  }
  Endpoint sendEndpoint=getSendEndpoint();
  int lqOrder=SimulcastStream.SIMULCAST_LAYER_ORDER_BASE;
  int hqOrder=simStreams.length - 1;
  int oldTargetOrder=targetOrder;
  boolean thisWasInTheSelectedEndpoints=oldEndpoints.contains(sendEndpoint);
  boolean thisWillbeInTheSelectedEndpoints=newEndpoints.contains(sendEndpoint);
  if (thisWillbeInTheSelectedEndpoints) {
    int overrideOrder=getSimulcastSenderManager().getOverrideOrder();
    if (overrideOrder == SimulcastSenderManager.SIMULCAST_LAYER_ORDER_NO_OVERRIDE) {
      targetOrder=hqOrder;
    }
 else {
      targetOrder=Math.min(hqOrder,overrideOrder);
    }
  }
 else   if (thisWasInTheSelectedEndpoints) {
    targetOrder=lqOrder;
  }
  if (oldTargetOrder != targetOrder)   react(false);
}

Fixed version (ground truth):
/** 
 * Handles a change in the selected endpoint.
 * @param oldEndpoints Set of the old selected endpoints.
 * @param newEndpoints Set of the new selected endpoints.
 */
private void selectedEndpointChanged(Set<Endpoint> oldEndpoints,Set<Endpoint> newEndpoints){
  if (logger.isDebugEnabled()) {
    if (newEndpoints.isEmpty())     logger.debug("String_Node_Str");
 else {
      StringBuilder newEndpointsIDList=new StringBuilder();
      for (      Endpoint e : newEndpoints) {
        newEndpointsIDList.append(e.getID());
        newEndpointsIDList.append("String_Node_Str");
      }
      logger.debug("String_Node_Str" + newEndpointsIDList.toString());
    }
  }
  SimulcastReceiver simulcastReceiver=getSimulcastReceiver();
  if (simulcastReceiver == null) {
    logger.warn("String_Node_Str" + "String_Node_Str");
    return;
  }
  SimulcastStream[] simStreams=simulcastReceiver.getSimulcastStreams();
  if (simStreams == null || simStreams.length == 0) {
    logger.warn("String_Node_Str" + "String_Node_Str");
    return;
  }
  Endpoint sendEndpoint=getSendEndpoint();
  int lqOrder=SimulcastStream.SIMULCAST_LAYER_ORDER_BASE;
  int hqOrder=simStreams.length - 1;
  int oldTargetOrder=targetOrder;
  boolean thisWasInTheSelectedEndpoints=oldEndpoints.contains(sendEndpoint);
  boolean thisWillbeInTheSelectedEndpoints=newEndpoints.contains(sendEndpoint);
  if (thisWillbeInTheSelectedEndpoints) {
    int overrideOrder=getSimulcastSenderManager().getOverrideOrder();
    if (overrideOrder == SimulcastSenderManager.SIMULCAST_LAYER_ORDER_NO_OVERRIDE) {
      targetOrder=hqOrder;
    }
 else {
      targetOrder=Math.min(hqOrder,overrideOrder);
    }
  }
 else   if (thisWasInTheSelectedEndpoints) {
    targetOrder=lqOrder;
  }
  if (oldTargetOrder != targetOrder) {
    SendMode sm=this.sendMode;
    if (sm != null) {
      this.sendMode.receive(targetOrder);
    }
  }
}