Program: 115670
Project: 115670
Buggy source:
public void handleGradientOfRequestsInFlightEvent(GradientOfRequestsInFlightEvent gradientOfRequestsInFlightEvent){
  String networkPartitionId=gradientOfRequestsInFlightEvent.getNetworkPartitionId();
  String clusterId=gradientOfRequestsInFlightEvent.getClusterId();
  String clusterInstanceId=gradientOfRequestsInFlightEvent.getClusterInstanceId();
  float value=gradientOfRequestsInFlightEvent.getValue();
  if (log.isDebugEnabled()) {
    log.debug(String.format("String_Node_Str" + "String_Node_Str",clusterId,clusterInstanceId,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 requestsInFlightGradient=value * clusterInstanceContext.getActiveMemberCount() / totalActiveMemberCount;
          clusterInstanceContext.setRequestsInFlightGradient(requestsInFlightGradient);
          log.debug(String.format("String_Node_Str" + "String_Node_Str",clusterId,clusterInstanceContext.getId(),networkPartitionId,requestsInFlightGradient));
        }
      }
    }
 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.setRequestsInFlightGradient(value);
    }
 else {
      if (log.isDebugEnabled()) {
        log.debug(String.format("String_Node_Str" + "String_Node_Str",networkPartitionId));
      }
    }
  }
}

Fixed version (ground truth):
public void handleGradientOfRequestsInFlightEvent(GradientOfRequestsInFlightEvent gradientOfRequestsInFlightEvent){
  String networkPartitionId=gradientOfRequestsInFlightEvent.getNetworkPartitionId();
  String clusterId=gradientOfRequestsInFlightEvent.getClusterId();
  String clusterInstanceId=gradientOfRequestsInFlightEvent.getClusterInstanceId();
  float value=gradientOfRequestsInFlightEvent.getValue();
  if (log.isDebugEnabled()) {
    log.debug(String.format("String_Node_Str" + "String_Node_Str",clusterId,clusterInstanceId,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 requestsInFlightGradient=value * clusterInstanceContext.getActiveMemberCount() / totalActiveMemberCount;
          clusterInstanceContext.setRequestsInFlightGradient(requestsInFlightGradient);
          log.debug(String.format("String_Node_Str" + "String_Node_Str",clusterId,clusterInstanceContext.getId(),networkPartitionId,requestsInFlightGradient));
        }
      }
    }
 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.setRequestsInFlightGradient(value);
    }
 else {
      if (log.isDebugEnabled()) {
        log.debug(String.format("String_Node_Str" + "String_Node_Str",networkPartitionId));
      }
    }
  }
}