Update the get cartridge group service method
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/02eafdf5 Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/02eafdf5 Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/02eafdf5 Branch: refs/heads/master Commit: 02eafdf534d4643db2e56a126d230a7d6fe9cb6a Parents: 861d6ac Author: gayangunarathne <[email protected]> Authored: Fri Aug 21 12:38:56 2015 +0530 Committer: gayangunarathne <[email protected]> Committed: Fri Aug 21 12:38:56 2015 +0530 ---------------------------------------------------------------------- .../services/impl/AutoscalerServiceImpl.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/stratos/blob/02eafdf5/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/services/impl/AutoscalerServiceImpl.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/services/impl/AutoscalerServiceImpl.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/services/impl/AutoscalerServiceImpl.java index e5fd50d..6c47116 100644 --- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/services/impl/AutoscalerServiceImpl.java +++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/services/impl/AutoscalerServiceImpl.java @@ -907,12 +907,14 @@ public class AutoscalerServiceImpl implements AutoscalerService { } try { ServiceGroup[] serviceGroups=getServiceGroupsByTenant(tenantId); - for(ServiceGroup serviceGroup:serviceGroups){ - if(serviceGroup.getName().equals(name)){ - selectedGroup=serviceGroup; - } - else{ - ServiceGroup[] innerGroups=serviceGroup.getGroups(); + for(ServiceGroup serviceGroup:serviceGroups) { + if (serviceGroup.getName().equals(name)) { + selectedGroup = serviceGroup; + return selectedGroup; + } + } + for(ServiceGroup serviceGroup:serviceGroups) { + ServiceGroup[] innerGroups=serviceGroup.getGroups(); while(innerGroups!=null){ for(ServiceGroup nestedGroup:innerGroups) { if(nestedGroup.getName().equals(name)){ @@ -923,7 +925,6 @@ public class AutoscalerServiceImpl implements AutoscalerService { } } } - } } return selectedGroup; } catch (Exception e) {
