Program: 116056
Project: 116056
Buggy source:
protected void handleDependentScaling(InstanceContext instanceContext,NetworkPartitionContext networkPartitionContext){
  List<ScalingEvent> highestScalingEventOfDependencies=new ArrayList<ScalingEvent>();
  for (  ScalingDependentList scalingDependentList : scalingDependencies) {
    ScalingEvent highestFactorEvent=null;
    for (    String scalingDependentListComponent : scalingDependentList.getScalingDependentListComponents()) {
      ScalingEvent scalingEvent=instanceContext.getScalingEvent(scalingDependentListComponent);
      if (highestFactorEvent == null) {
        highestFactorEvent=scalingEvent;
      }
 else {
        if (scalingEvent.getFactor() > highestFactorEvent.getFactor()) {
          highestFactorEvent=scalingEvent;
        }
      }
    }
    highestScalingEventOfDependencies.add(highestFactorEvent);
  }
  for (  ScalingEvent highestScalingEventOfChild : highestScalingEventOfDependencies) {
    if (scalingDependencies != null && !scalingDependencies.isEmpty()) {
      for (      ScalingDependentList scalingDependentList : scalingDependencies) {
        if (scalingDependentList.getScalingDependentListComponents().contains(highestScalingEventOfChild.getId())) {
          for (          String scalingDependentListComponent : scalingDependentList.getScalingDependentListComponents()) {
            Monitor monitor=aliasToActiveMonitorsMap.get(scalingDependentListComponent);
            if (monitor instanceof GroupMonitor || monitor instanceof VMClusterMonitor) {
              ScalingEvent scalingEvent=new ScalingEvent(monitor.getId(),networkPartitionContext.getId(),instanceContext.getId(),highestScalingEventOfChild.getFactor());
              monitor.onParentScalingEvent(scalingEvent);
            }
          }
        }
        break;
      }
    }
  }
  instanceContext.setIdToScalingEvent(new HashMap<String,ScalingEvent>());
}

Fixed version (ground truth):
protected void handleDependentScaling(InstanceContext instanceContext,NetworkPartitionContext networkPartitionContext){
  List<ScalingEvent> highestScalingEventOfDependencies=new ArrayList<ScalingEvent>();
  for (  ScalingDependentList scalingDependentList : scalingDependencies) {
    ScalingEvent highestFactorEvent=null;
    for (    String scalingDependentListComponent : scalingDependentList.getScalingDependentListComponents()) {
      ScalingEvent scalingEvent=instanceContext.getScalingEvent(scalingDependentListComponent);
      if (scalingEvent != null) {
        if (highestFactorEvent == null) {
          highestFactorEvent=scalingEvent;
        }
 else {
          if (scalingEvent.getFactor() > highestFactorEvent.getFactor()) {
            highestFactorEvent=scalingEvent;
          }
        }
      }
    }
    if (highestFactorEvent != null) {
      if (log.isDebugEnabled()) {
        log.debug("String_Node_Str" + highestFactorEvent.getId() + "String_Node_Str"+ highestFactorEvent.getFactor());
      }
      highestScalingEventOfDependencies.add(highestFactorEvent);
    }
  }
  for (  ScalingEvent highestScalingEventOfChild : highestScalingEventOfDependencies) {
    if (scalingDependencies != null && !scalingDependencies.isEmpty()) {
      for (      ScalingDependentList scalingDependentList : scalingDependencies) {
        if (scalingDependentList.getScalingDependentListComponents().contains(highestScalingEventOfChild.getId())) {
          for (          String scalingDependentListComponent : scalingDependentList.getScalingDependentListComponents()) {
            Monitor monitor=aliasToActiveMonitorsMap.get(scalingDependentListComponent);
            if (monitor instanceof GroupMonitor || monitor instanceof VMClusterMonitor) {
              ScalingEvent scalingEvent=new ScalingEvent(monitor.getId(),networkPartitionContext.getId(),instanceContext.getId(),highestScalingEventOfChild.getFactor());
              if (log.isDebugEnabled()) {
                log.debug("String_Node_Str" + scalingEvent.getId() + "String_Node_Str"+ scalingEvent.getInstanceId()+ "String_Node_Str"+ scalingEvent.getFactor()+ "String_Node_Str");
              }
              monitor.onParentScalingEvent(scalingEvent);
            }
          }
        }
        break;
      }
    }
  }
  instanceContext.setIdToScalingEvent(new HashMap<String,ScalingEvent>());
}