Program: 115671
Project: 115671
Buggy source:
public void handleSecondDerivativeOfRequestsInFlightEvent(SecondDerivativeOfRequestsInFlightEvent secondDerivativeOfRequestsInFlightEvent){
  String networkPartitionId=secondDerivativeOfRequestsInFlightEvent.getNetworkPartitionId();
  String clusterId=secondDerivativeOfRequestsInFlightEvent.getClusterId();
  String clusterInstanceId=secondDerivativeOfRequestsInFlightEvent.getClusterInstanceId();
  float value=secondDerivativeOfRequestsInFlightEvent.getValue();
  if (log.isDebugEnabled()) {
    log.debug(String.format("String_Node_Str" + "String_Node_Str",clusterId,networkPartitionId,value));
  }
  if (clusterInstanceId.equals(StratosConstants.NOT_DEFINED)) {
    ClusterLevelNetworkPartitionContext networkPartitionContext=getNetworkPartitionContext(networkPartitionId);
    if (null != networkPartitionContext) {
      int totalActiveMemberCount=0;
      for (      InstanceContext clusterInstanceContext : networkPartitionContext.getActiveInstances()) {
        if (clusterInstanceContext instanceof ClusterInstanceContext) {
          totalActiveMemberCount+=((ClusterInstanceContext)clusterInstanceContext).getActiveMemberCount();
        }
      }
      for (      InstanceContext instanceContext : networkPartitionContext.getActiveInstances()) {
        if (instanceContext instanceof ClusterInstanceContext) {
          ClusterInstanceContext clusterInstanceContext=((ClusterInstanceContext)instanceContext);
          float requestsInFlightSecondDerivative=value * clusterInstanceContext.getActiveMemberCount() / totalActiveMemberCount;
          clusterInstanceContext.setRequestsInFlightSecondDerivative(requestsInFlightSecondDerivative);
          log.debug(String.format("String_Node_Str" + "String_Node_Str",clusterId,clusterInstanceContext.getId(),networkPartitionId,requestsInFlightSecondDerivative));
        }
      }
    }
 else {
      if (log.isDebugEnabled()) {
        log.debug(String.format("String_Node_Str" + "String_Node_Str",networkPartitionId));
      }
    }
  }
 else {
    ClusterInstanceContext clusterLevelNetworkPartitionContext=getClusterInstanceContext(networkPartitionId,clusterInstanceId);
    if (null != clusterLevelNetworkPartitionContext) {
      clusterLevelNetworkPartitionContext.setRequestsInFlightSecondDerivative(value);
    }
 else {
      if (log.isDebugEnabled()) {
        log.debug(String.format("String_Node_Str" + "String_Node_Str",networkPartitionId));
      }
    }
  }
}

Fixed version (ground truth):
public void handleSecondDerivativeOfRequestsInFlightEvent(SecondDerivativeOfRequestsInFlightEvent secondDerivativeOfRequestsInFlightEvent){
  String networkPartitionId=secondDerivativeOfRequestsInFlightEvent.getNetworkPartitionId();
  String clusterId=secondDerivativeOfRequestsInFlightEvent.getClusterId();
  String clusterInstanceId=secondDerivativeOfRequestsInFlightEvent.getClusterInstanceId();
  float value=secondDerivativeOfRequestsInFlightEvent.getValue();
  if (log.isDebugEnabled()) {
    log.debug(String.format("String_Node_Str" + "String_Node_Str",clusterId,networkPartitionId,value));
  }
  if (clusterInstanceId.equals(StratosConstants.NOT_DEFINED)) {
    ClusterLevelNetworkPartitionContext networkPartitionContext=getNetworkPartitionContext(networkPartitionId);
    if (null != networkPartitionContext) {
      int totalActiveMemberCount=0;
      for (      InstanceContext clusterInstanceContext : networkPartitionContext.getInstanceIdToInstanceContextMap().values()) {
        if (clusterInstanceContext instanceof ClusterInstanceContext) {
          totalActiveMemberCount+=((ClusterInstanceContext)clusterInstanceContext).getActiveMemberCount();
        }
      }
      for (      InstanceContext instanceContext : networkPartitionContext.getInstanceIdToInstanceContextMap().values()) {
        if (instanceContext instanceof ClusterInstanceContext) {
          ClusterInstanceContext clusterInstanceContext=((ClusterInstanceContext)instanceContext);
          float requestsInFlightSecondDerivative=value * clusterInstanceContext.getActiveMemberCount() / totalActiveMemberCount;
          clusterInstanceContext.setRequestsInFlightSecondDerivative(requestsInFlightSecondDerivative);
          log.debug(String.format("String_Node_Str" + "String_Node_Str",clusterId,clusterInstanceContext.getId(),networkPartitionId,requestsInFlightSecondDerivative));
        }
      }
    }
 else {
      if (log.isDebugEnabled()) {
        log.debug(String.format("String_Node_Str" + "String_Node_Str",networkPartitionId));
      }
    }
  }
 else {
    ClusterInstanceContext clusterLevelNetworkPartitionContext=getClusterInstanceContext(networkPartitionId,clusterInstanceId);
    if (null != clusterLevelNetworkPartitionContext) {
      clusterLevelNetworkPartitionContext.setRequestsInFlightSecondDerivative(value);
    }
 else {
      if (log.isDebugEnabled()) {
        log.debug(String.format("String_Node_Str" + "String_Node_Str",networkPartitionId));
      }
    }
  }
}