Program: 115565
Project: 115565
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, CartridgeNotFoundException {
  Group group=new Group(appId,groupCtxt.getName(),groupCtxt.getAlias());
  group.setGroupScalingEnabled(groupCtxt.getGroupMaxInstances() > 1);
  group.setGroupMinInstances(groupCtxt.getGroupMinInstances());
  group.setGroupMaxInstances(groupCtxt.getGroupMaxInstances());
  DependencyOrder dependencyOrder=new DependencyOrder();
  String[] startupOrders=getStartupOrderForGroup(groupCtxt.getName(),serviceGroup);
  Set<StartupOrder> setStartUpOrder=null;
  if (startupOrders != null) {
    setStartUpOrder=ParserUtils.convertStartupOrder(startupOrders,groupCtxt);
    dependencyOrder.setStartupOrders(setStartUpOrder);
  }
 else {
    if (log.isDebugEnabled()) {
      String msg=String.format("String_Node_Str",groupCtxt.getAlias());
      log.debug(msg);
    }
  }
  String[] scaleDependents=getScaleDependentForGroup(groupCtxt.getName(),serviceGroup);
  if (scaleDependents != null) {
    dependencyOrder.setScalingDependents(ParserUtils.convertScalingDependentList(scaleDependents,groupCtxt));
  }
 else {
    if (log.isDebugEnabled()) {
      String msg=String.format("String_Node_Str",groupCtxt.getAlias());
      log.debug(msg);
    }
  }
  dependencyOrder.setTerminationBehaviour(getTerminationBehaviour(groupCtxt.getName(),serviceGroup));
  group.setDependencyOrder(dependencyOrder);
  Map<String,Map<String,ClusterDataHolder>> clusterDataMap;
  if (groupCtxt.getCartridgeContexts() != null) {
    clusterDataMap=parseLeafLevelSubscriptions(appId,tenantId,key,groupCtxt.getName(),Arrays.asList(groupCtxt.getCartridgeContexts()),setStartUpOrder);
    group.setClusterData(clusterDataMap.get(ALIAS));
    group.setClusterDataForType(clusterDataMap.get(CARTRIDGE_TYPE));
  }
  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.getUuid().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, CartridgeNotFoundException {
  Group group=new Group(appId,groupCtxt.getName(),groupCtxt.getAlias());
  group.setGroupScalingEnabled(groupCtxt.getGroupMaxInstances() > 1);
  group.setGroupMinInstances(groupCtxt.getGroupMinInstances());
  group.setGroupMaxInstances(groupCtxt.getGroupMaxInstances());
  DependencyOrder dependencyOrder=new DependencyOrder();
  String[] startupOrders=getStartupOrderForGroup(groupCtxt.getUuid(),serviceGroup);
  Set<StartupOrder> setStartUpOrder=null;
  if (startupOrders != null) {
    setStartUpOrder=ParserUtils.convertStartupOrder(startupOrders,groupCtxt);
    dependencyOrder.setStartupOrders(setStartUpOrder);
  }
 else {
    if (log.isDebugEnabled()) {
      String msg=String.format("String_Node_Str",groupCtxt.getAlias());
      log.debug(msg);
    }
  }
  String[] scaleDependents=getScaleDependentForGroup(groupCtxt.getUuid(),serviceGroup);
  if (scaleDependents != null) {
    dependencyOrder.setScalingDependents(ParserUtils.convertScalingDependentList(scaleDependents,groupCtxt));
  }
 else {
    if (log.isDebugEnabled()) {
      String msg=String.format("String_Node_Str",groupCtxt.getAlias());
      log.debug(msg);
    }
  }
  dependencyOrder.setTerminationBehaviour(getTerminationBehaviour(groupCtxt.getUuid(),serviceGroup));
  group.setDependencyOrder(dependencyOrder);
  Map<String,Map<String,ClusterDataHolder>> clusterDataMap;
  if (groupCtxt.getCartridgeContexts() != null) {
    clusterDataMap=parseLeafLevelSubscriptions(appId,tenantId,key,groupCtxt.getName(),Arrays.asList(groupCtxt.getCartridgeContexts()),setStartUpOrder);
    group.setClusterData(clusterDataMap.get(ALIAS));
    group.setClusterDataForType(clusterDataMap.get(CARTRIDGE_TYPE));
  }
  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.getUuid().equals(subGroupCtxt.getName())) {
            Group nestedGroup=parseGroup(appId,tenantId,key,subGroupCtxt,subscribableInfoCtxts,nestedServiceGroup);
            nestedGroups.put(nestedGroup.getAlias(),nestedGroup);
          }
        }
      }
    }
    group.setGroups(nestedGroups);
  }
  return group;
}