Fix a bug in populateImportGraph() that would infinite loop in
the presence of a cycle.
git-svn-id: https://svn.apache.org/repos/asf/incubator/felix/trunk@306809 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/framework/src/org/apache/felix/framework/Felix.java b/framework/src/org/apache/felix/framework/Felix.java
index 94001ab..d7a11bb 100644
--- a/framework/src/org/apache/felix/framework/Felix.java
+++ b/framework/src/org/apache/felix/framework/Felix.java
@@ -2638,11 +2638,15 @@
(importers != null) && (impIdx < importers.length);
impIdx++)
{
+ // Avoid cycles if the bundle is already in map.
+ if (!map.containsKey(importers[impIdx]))
+ {
// Add each importing bundle to map.
map.put(importers[impIdx], importers[impIdx]);
// Now recurse into each bundle to get its importers.
populateImportGraph(
(BundleImpl) importers[impIdx], map);
+ }
}
}
}