Program: 116050
Project: 116050
Buggy source:
/** 
 * Parses an individual Group
 * @param appId Application id
 * @param tenantId tenant id of tenant which deployed the Application
 * @param key Generated key for the Application
 * @param groupCtxt Group definition information
 * @param subscribableInfoCtxts Map [cartridge alias -> Group] with extracted Subscription Information
 * @return  Group object
 * @throws ApplicationDefinitionException if unable to parse
 */
private Group parseGroup(String appId,int tenantId,String key,GroupContext groupCtxt,Map<String,SubscribableInfoContext> subscribableInfoCtxts,ServiceGroup serviceGroup) throws ApplicationDefinitionException {
  Group group=new Group(appId,groupCtxt.getName(),groupCtxt.getAlias());
  group.setGroupScalingEnabled(isGroupScalingEnabled(groupCtxt.getName(),serviceGroup));
  group.setGroupMinInstances(groupCtxt.getGroupMinInstances());
  group.setGroupMaxInstances(groupCtxt.getGroupMaxInstances());
  DependencyOrder dependencyOrder=new DependencyOrder();
  String[] startupOrders=getStartupOrderForGroup(groupCtxt.getName(),serviceGroup);
  if (startupOrders != null) {
    dependencyOrder.setStartupOrders(ParserUtils.convertStartupOrder(startupOrders,groupCtxt));
  }
  dependencyOrder.setTerminationBehaviour(getKillbehaviour(groupCtxt.getName(),serviceGroup));
  group.setDependencyOrder(dependencyOrder);
  Map<String,ClusterDataHolder> clusterDataMap;
  if (groupCtxt.getCartridgeContexts() != null) {
    clusterDataMap=parseLeafLevelSubscriptions(appId,tenantId,key,groupCtxt.getName(),Arrays.asList(groupCtxt.getCartridgeContexts()));
    group.setClusterData(clusterDataMap);
  }
  if (groupCtxt.getGroupContexts() != null) {
    Map<String,Group> nestedGroups=new HashMap<String,Group>();
    for (    GroupContext subGroupCtxt : groupCtxt.getGroupContexts()) {
      if (subGroupCtxt != null) {
        for (        ServiceGroup nestedServiceGroup : serviceGroup.getGroups()) {
          if (nestedServiceGroup.getName().equals(subGroupCtxt.getName())) {
            Group nestedGroup=parseGroup(appId,tenantId,key,subGroupCtxt,subscribableInfoCtxts,nestedServiceGroup);
            nestedGroups.put(nestedGroup.getAlias(),nestedGroup);
          }
        }
      }
    }
    group.setGroups(nestedGroups);
  }
  return group;
}

Fixed version (ground truth):
/** 
 * Parses an individual Group
 * @param appId Application id
 * @param tenantId tenant id of tenant which deployed the Application
 * @param key Generated key for the Application
 * @param groupCtxt Group definition information
 * @param subscribableInfoCtxts Map [cartridge alias -> Group] with extracted Subscription Information
 * @return  Group object
 * @throws ApplicationDefinitionException if unable to parse
 */
private Group parseGroup(String appId,int tenantId,String key,GroupContext groupCtxt,Map<String,SubscribableInfoContext> subscribableInfoCtxts,ServiceGroup serviceGroup) throws ApplicationDefinitionException {
  Group group=new Group(appId,groupCtxt.getName(),groupCtxt.getAlias());
  group.setGroupScalingEnabled(isGroupScalingEnabled(groupCtxt.getName(),serviceGroup));
  group.setGroupMinInstances(groupCtxt.getGroupMinInstances());
  group.setGroupMaxInstances(groupCtxt.getGroupMaxInstances());
  DependencyOrder dependencyOrder=new DependencyOrder();
  String[] startupOrders=getStartupOrderForGroup(groupCtxt.getName(),serviceGroup);
  if (startupOrders != null) {
    dependencyOrder.setStartupOrders(ParserUtils.convertStartupOrder(startupOrders,groupCtxt));
  }
  String[] scaleDependents=getScaleDependentForGroup(groupCtxt.getName(),serviceGroup);
  if (scaleDependents != null) {
    dependencyOrder.setScalingDependents(ParserUtils.convertScalingDependentList(scaleDependents,groupCtxt));
  }
  dependencyOrder.setTerminationBehaviour(getKillbehaviour(groupCtxt.getName(),serviceGroup));
  group.setDependencyOrder(dependencyOrder);
  Map<String,ClusterDataHolder> clusterDataMap;
  if (groupCtxt.getCartridgeContexts() != null) {
    clusterDataMap=parseLeafLevelSubscriptions(appId,tenantId,key,groupCtxt.getName(),Arrays.asList(groupCtxt.getCartridgeContexts()));
    group.setClusterData(clusterDataMap);
  }
  if (groupCtxt.getGroupContexts() != null) {
    Map<String,Group> nestedGroups=new HashMap<String,Group>();
    for (    GroupContext subGroupCtxt : groupCtxt.getGroupContexts()) {
      if (subGroupCtxt != null) {
        for (        ServiceGroup nestedServiceGroup : serviceGroup.getGroups()) {
          if (nestedServiceGroup.getName().equals(subGroupCtxt.getName())) {
            Group nestedGroup=parseGroup(appId,tenantId,key,subGroupCtxt,subscribableInfoCtxts,nestedServiceGroup);
            nestedGroups.put(nestedGroup.getAlias(),nestedGroup);
          }
        }
      }
    }
    group.setGroups(nestedGroups);
  }
  return group;
}