Program: 115507
Project: 115507
Buggy source:
/** 
 * This method is to validate the application definition to have unique aliases among its groups
 * @param applicationDefinition - the application definition
 * @throws RestAPIException
 */
private static void validateGroupsInApplicationDefinition(ApplicationBean applicationDefinition) throws RestAPIException {
  ConcurrentHashMap<String,CartridgeGroupReferenceBean> groupsInApplicationDefinition=new ConcurrentHashMap<String,CartridgeGroupReferenceBean>();
  boolean groupParentHasDeploymentPolicy=false;
  if ((applicationDefinition.getComponents().getGroups() != null) && (!applicationDefinition.getComponents().getGroups().isEmpty())) {
    for (    CartridgeGroupReferenceBean group : applicationDefinition.getComponents().getGroups()) {
      if (groupsInApplicationDefinition.get(group.getAlias()) != null) {
        String message="String_Node_Str" + group.getAlias();
        throw new RestAPIException(message);
      }
      if (group.getCartridges() != null) {
        if (group.getDeploymentPolicy() != null) {
          groupParentHasDeploymentPolicy=true;
        }
 else {
          groupParentHasDeploymentPolicy=false;
        }
        validateCartridgesForDeploymentPolicy(group.getCartridges(),groupParentHasDeploymentPolicy);
      }
      groupsInApplicationDefinition.put(group.getAlias(),group);
      if (group.getGroups() != null) {
        validateGroupsRecursively(groupsInApplicationDefinition,group.getGroups(),groupParentHasDeploymentPolicy);
      }
    }
  }
  if ((applicationDefinition.getComponents().getCartridges() != null) && (!applicationDefinition.getComponents().getCartridges().isEmpty())) {
    validateCartridgesForDeploymentPolicy(applicationDefinition.getComponents().getCartridges(),false);
  }
}

Fixed version (ground truth):
/** 
 * This method is to validate the application definition to have unique aliases among its groups
 * @param applicationDefinition - the application definition
 * @throws RestAPIException
 */
private static void validateGroupsInApplicationDefinition(ApplicationBean applicationDefinition) throws RestAPIException {
  ConcurrentHashMap<String,CartridgeGroupReferenceBean> groupsInApplicationDefinition=new ConcurrentHashMap<String,CartridgeGroupReferenceBean>();
  boolean groupParentHasDeploymentPolicy=false;
  if ((applicationDefinition.getComponents().getGroups() != null) && (!applicationDefinition.getComponents().getGroups().isEmpty())) {
    for (    CartridgeGroupReferenceBean group : applicationDefinition.getComponents().getGroups()) {
      if (groupsInApplicationDefinition.get(group.getAlias()) != null) {
        String message="String_Node_Str" + group.getAlias();
        throw new RestAPIException(message);
      }
      if (group.getCartridges() != null) {
        groupParentHasDeploymentPolicy=group.getDeploymentPolicy() != null;
        validateCartridgesForDeploymentPolicy(group.getCartridges(),groupParentHasDeploymentPolicy);
      }
      groupsInApplicationDefinition.put(group.getAlias(),group);
      if (group.getGroups() != null) {
        validateGroupsRecursively(groupsInApplicationDefinition,group.getGroups(),groupParentHasDeploymentPolicy);
      }
    }
  }
  if ((applicationDefinition.getComponents().getCartridges() != null) && (!applicationDefinition.getComponents().getCartridges().isEmpty())) {
    validateCartridgesForDeploymentPolicy(applicationDefinition.getComponents().getCartridges(),false);
  }
}