Need to return provided wires in the order in which capabilities
were declared. (FELIX-2950)
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1143500 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/framework/src/main/java/org/apache/felix/framework/BundleRevisionDependencies.java b/framework/src/main/java/org/apache/felix/framework/BundleRevisionDependencies.java
index 1611842..d00c9dd 100644
--- a/framework/src/main/java/org/apache/felix/framework/BundleRevisionDependencies.java
+++ b/framework/src/main/java/org/apache/felix/framework/BundleRevisionDependencies.java
@@ -130,15 +130,22 @@
{
List<BundleWire> providedWires = new ArrayList<BundleWire>();
- Map<BundleCapability, Set<BundleWire>> caps =
+ Map<BundleCapability, Set<BundleWire>> providedCaps =
m_dependentsMap.get(revision);
- if (caps != null)
+ if (providedCaps != null)
{
- for (Entry<BundleCapability, Set<BundleWire>> entry : caps.entrySet())
+ // The wires are supposed to be in declared capability order, so
+ // get the capability list from the revision's wiring, which is
+ // in declared order (including fragments), and use it to create
+ // the provided wire list in declared order.
+ List<BundleCapability> resolvedCaps =
+ revision.getWiring().getCapabilities(namespace);
+ for (BundleCapability resolvedCap : resolvedCaps)
{
- if ((namespace == null) || entry.getKey().getNamespace().equals(namespace))
+ Set<BundleWire> dependentWires = providedCaps.get(resolvedCap);
+ if (dependentWires != null)
{
- providedWires.addAll(entry.getValue());
+ providedWires.addAll(dependentWires);
}
}
}