Program: 116044
Project: 116044
Buggy source:
public synchronized void monitor(){
  final Collection<NetworkPartitionContext> networkPartitionContexts=this.networkPartitionCtxts.values();
  Runnable monitoringRunnable=new Runnable(){
    @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);
            }
          }
        }
      }
    }
  }
;
  monitoringRunnable.run();
}

Fixed version (ground truth):
public synchronized void monitor(){
  final Collection<NetworkPartitionContext> networkPartitionContexts=this.networkPartitionCtxts.values();
  Runnable monitoringRunnable=new Runnable(){
    @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);
            }
          }
        }
      }
    }
  }
;
  monitoringRunnable.run();
}