You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by is...@apache.org on 2014/07/21 16:57:39 UTC

git commit: fixing a bug in building composite app structure

Repository: stratos
Updated Branches:
  refs/heads/4.0.0-grouping 110584a32 -> 78bf6dac9


fixing a bug in building composite app structure


Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/78bf6dac
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/78bf6dac
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/78bf6dac

Branch: refs/heads/4.0.0-grouping
Commit: 78bf6dac9d7421b838553c5e42f88e7b8bf80cb8
Parents: 110584a
Author: Isuru Haththotuwa <is...@apache.org>
Authored: Mon Jul 21 20:27:15 2014 +0530
Committer: Isuru Haththotuwa <is...@apache.org>
Committed: Mon Jul 21 20:27:15 2014 +0530

----------------------------------------------------------------------
 .../DefaultCompositeApplicationParser.java      | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/78bf6dac/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/composite/application/parser/DefaultCompositeApplicationParser.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/composite/application/parser/DefaultCompositeApplicationParser.java b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/composite/application/parser/DefaultCompositeApplicationParser.java
index c8b6998..0f24708 100644
--- a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/composite/application/parser/DefaultCompositeApplicationParser.java
+++ b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/composite/application/parser/DefaultCompositeApplicationParser.java
@@ -264,18 +264,20 @@ public class DefaultCompositeApplicationParser implements CompositeApplicationPa
 
     private void filterDuplicatedGroupContexts (Set<GroupContext> topLevelGroupContexts, Set<GroupContext> nestedGroupContexts) {
 
-        Iterator<GroupContext> parentIterator = topLevelGroupContexts.iterator();
-        Iterator<GroupContext> nestedIterator = nestedGroupContexts.iterator();
+        for (GroupContext nestedGropCtxt : nestedGroupContexts) {
+            filterNestedGroupFromTopLevel(topLevelGroupContexts, nestedGropCtxt);
+        }
+    }
 
+    private void filterNestedGroupFromTopLevel (Set<GroupContext> topLevelGroupContexts, GroupContext nestedGroupCtxt) {
+
+        Iterator<GroupContext> parentIterator = topLevelGroupContexts.iterator();
         while (parentIterator.hasNext()) {
             GroupContext parentGroupCtxt = parentIterator.next();
-            while (nestedIterator.hasNext()) {
-                GroupContext nestedGroupCtxt = nestedIterator.next();
-                // if there is an exactly similar nested Group Context and a top level Group Context
-                // it implies that they are duplicates. Should be removed from top level.
-                if (parentGroupCtxt.equals(nestedGroupCtxt)) {
-                    parentIterator.remove();
-                }
+            // if there is an exactly similar nested Group Context and a top level Group Context
+            // it implies that they are duplicates. Should be removed from top level.
+            if (parentGroupCtxt.equals(nestedGroupCtxt)) {
+                parentIterator.remove();
             }
         }
     }