Program: 115740
Project: 115740
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 (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=aliasToActiveChildMonitorsMap.get(scalingDependentListComponent);
            if (monitor instanceof GroupMonitor || monitor instanceof ClusterMonitor) {
              ScalingEvent scalingEvent=new ScalingEvent(monitor.getId(),networkPartitionContext.getId(),instanceContext.getId(),highestScalingEventOfChild.getFactor());
              log.info("String_Node_Str" + scalingEvent.getId() + "String_Node_Str"+ scalingEvent.getInstanceId()+ "String_Node_Str"+ scalingEvent.getFactor()+ "String_Node_Str");
              monitor.onParentScalingEvent(scalingEvent);
            }
          }
        }
        break;
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * handling the dependent scaling
 * @param instanceContext
 * @param networkPartitionContext
 */
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=aliasToActiveChildMonitorsMap.get(scalingDependentListComponent);
            if (monitor instanceof GroupMonitor || monitor instanceof ClusterMonitor) {
              ScalingEvent scalingEvent=new ScalingEvent(monitor.getId(),networkPartitionContext.getId(),instanceContext.getId(),highestScalingEventOfChild.getFactor());
              log.info("String_Node_Str" + scalingEvent.getId() + "String_Node_Str"+ scalingEvent.getInstanceId()+ "String_Node_Str"+ scalingEvent.getFactor()+ "String_Node_Str");
              monitor.onParentScalingEvent(scalingEvent);
            }
          }
        }
        break;
      }
    }
  }
}