Need to double check for a cycle when creating wires for a fragment. (FELIX-852)


git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@745610 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/framework/src/main/java/org/apache/felix/framework/searchpolicy/Resolver.java b/framework/src/main/java/org/apache/felix/framework/searchpolicy/Resolver.java
index c6258f1..4d3224a 100644
--- a/framework/src/main/java/org/apache/felix/framework/searchpolicy/Resolver.java
+++ b/framework/src/main/java/org/apache/felix/framework/searchpolicy/Resolver.java
@@ -1553,6 +1553,13 @@
             // Instead of creating wires for the fragment, we will create them
             // for the host.
             importer = host;
+
+            // Make sure we haven't already seen the host to avoid a cycle.
+            if (wireMap.get(importer) != null)
+            {
+                return wireMap;
+            }
+
             // Now add the fragments candidates to the host.
             candSetList = (List) candidatesMap.get(host);
             for (int csIdx = 0; (host == null) && (csIdx < candSetList.size()); csIdx++)