Github user Vishanth commented on a diff in the pull request:

    https://github.com/apache/stratos/pull/296#discussion_r29826974
  
    --- Diff: 
components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41Utils.java
 ---
    @@ -980,50 +981,41 @@ public static void addServiceGroup(GroupBean 
serviceGroupDefinition) throws Rest
                 List<String> groupNames;
                 String[] cartridgeGroupNames;
     
    -            // if any cartridges are specified in the group, they should 
be already deployed
    -            if (serviceGroupDefinition.getCartridges() != null) {
    +            if (log.isDebugEnabled()) {
    +                log.debug("checking cartridges in cartridge group " + 
serviceGroupDefinition.getName());
    +            }
     
    -                if (log.isDebugEnabled()) {
    -                    log.debug("checking cartridges in cartridge group " + 
serviceGroupDefinition.getName());
    -                }
    +            findCartridgesInGroupBean(serviceGroupDefinition, 
cartridgeTypes);
     
    -                findCartridgesInGroupBean(serviceGroupDefinition, 
cartridgeTypes);
    +            //validate the group definition to check if cartridges 
duplicate in any groups defined
    +            
validateCartridgeDuplicationInGroupDefinition(serviceGroupDefinition);
     
    -                Set<String> duplicates = findDuplicates(cartridgeTypes);
    -                if (duplicates.size() > 0) {
    -                    StringBuilder duplicatesOutput = new StringBuilder();
    -                    for (String dup : duplicates) {
    -                        duplicatesOutput.append(dup).append(" ");
    -                    }
    -                    if (log.isDebugEnabled()) {
    -                        log.debug("duplicate cartridges defined: " + 
duplicatesOutput.toString());
    -                    }
    -                    throw new RestAPIException("Invalid Service Group 
definition, duplicate cartridges defined:" +
    -                            duplicatesOutput.toString());
    -                }
    +            //validate the group definition to check if groups duplicate 
in any groups and
    +            //validate the group definition to check for cyclic group 
behaviour
    +            
validateGroupDuplicationInGroupDefinition(serviceGroupDefinition, new 
ArrayList<String>());
    --- End diff --
    
    Since that method is recursive, at the first point of call a new array list 
is passed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to