Program: 116043
Project: 116043
Buggy source:
@Override public void run(){
  if (log.isDebugEnabled()) {
    log.debug("String_Node_Str" + this.toString());
  }
  for (  NetworkPartitionContext networkPartitionContext : networkPartitionContexts) {
    for (    InstanceContext instanceContext : networkPartitionContext.getInstanceIdToInstanceContextMap().values()) {
      GroupInstance instance=(GroupInstance)instanceIdToInstanceMap.get(instanceContext.getId());
      if (instance.getStatus().getCode() <= GroupStatus.Active.getCode()) {
        if (!instanceContext.getIdToScalingOverMaxEvent().isEmpty()) {
          if (!hasScalingDependents) {
            if (groupScalingEnabled && networkPartitionContext.getPendingInstancesCount() > 0) {
              if (log.isDebugEnabled()) {
                log.debug("String_Node_Str" + id + "String_Node_Str"+ "String_Node_Str");
              }
              boolean createOnDemand=createInstanceOnDemand(instanceContext.getParentInstanceId());
              if (!createOnDemand) {
                MonitorStatusEventBuilder.handleScalingOverMaxEvent(parent,networkPartitionContext.getId(),instanceContext.getId(),appId);
              }
 else {
                instanceContext.setIdToScalingOverMaxEvent(new HashMap<String,ScalingOverMaxEvent>());
              }
            }
 else {
              MonitorStatusEventBuilder.handleScalingOverMaxEvent(parent,networkPartitionContext.getId(),instanceContext.getId(),appId);
            }
          }
 else {
            if (log.isDebugEnabled()) {
              log.debug("String_Node_Str" + id + "String_Node_Str"+ "String_Node_Str"+ parent.getId());
            }
            MonitorStatusEventBuilder.handleScalingOverMaxEvent(parent,networkPartitionContext.getId(),instanceContext.getId(),appId);
          }
        }
 else {
          handleDependentScaling(instanceContext,networkPartitionContext);
        }
      }
    }
  }
}

Fixed version (ground truth):
@Override public void run(){
  if (log.isDebugEnabled()) {
    log.debug("String_Node_Str" + this.toString());
  }
  for (  NetworkPartitionContext networkPartitionContext : networkPartitionContexts) {
    for (    InstanceContext instanceContext : networkPartitionContext.getInstanceIdToInstanceContextMap().values()) {
      GroupInstance instance=(GroupInstance)instanceIdToInstanceMap.get(instanceContext.getId());
      if (instance.getStatus().getCode() <= GroupStatus.Active.getCode()) {
        if (!instanceContext.getIdToScalingOverMaxEvent().isEmpty()) {
          if (!hasScalingDependents) {
            if (groupScalingEnabled) {
              if (networkPartitionContext.getPendingInstancesCount() == 0) {
                if (log.isDebugEnabled()) {
                  log.debug("String_Node_Str" + id + "String_Node_Str"+ "String_Node_Str");
                }
                boolean createOnDemand=createInstanceOnDemand(instanceContext.getParentInstanceId());
                if (!createOnDemand) {
                  MonitorStatusEventBuilder.handleScalingOverMaxEvent(parent,networkPartitionContext.getId(),instanceContext.getId(),appId);
                }
              }
 else {
                if (log.isDebugEnabled()) {
                  log.debug("String_Node_Str" + "String_Node_Str");
                }
              }
            }
 else {
              MonitorStatusEventBuilder.handleScalingOverMaxEvent(parent,networkPartitionContext.getId(),instanceContext.getId(),appId);
            }
          }
 else {
            if (log.isDebugEnabled()) {
              log.debug("String_Node_Str" + id + "String_Node_Str"+ "String_Node_Str"+ parent.getId());
            }
            MonitorStatusEventBuilder.handleScalingOverMaxEvent(parent,networkPartitionContext.getId(),instanceContext.getId(),appId);
          }
          instanceContext.setIdToScalingOverMaxEvent(new HashMap<String,ScalingOverMaxEvent>());
        }
 else {
          handleDependentScaling(instanceContext,networkPartitionContext);
        }
      }
    }
  }
}