You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by ri...@apache.org on 2011/07/22 22:55:27 UTC
svn commit: r1149732 -
/felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleWiringImpl.java
Author: rickhall
Date: Fri Jul 22 20:55:26 2011
New Revision: 1149732
URL: http://svn.apache.org/viewvc?rev=1149732&view=rev
Log:
When calculating resolved requirements, we must special case
fragments since they can have multiple wires for the same host
requirement, so we must avoid duplicates. (FELIX-2950)
Modified:
felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleWiringImpl.java
Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleWiringImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleWiringImpl.java?rev=1149732&r1=1149731&r2=1149732&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleWiringImpl.java (original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleWiringImpl.java Fri Jul 22 20:55:26 2011
@@ -193,11 +193,17 @@ public class BundleWiringImpl implements
// First add resolved requirements from wires.
for (BundleWire bw : wires)
{
- reqList.add(bw.getRequirement());
- if (bw.getRequirement().getNamespace().equals(BundleRevision.PACKAGE_NAMESPACE))
+ // Fragments may have multiple wires for the same requirement, so we
+ // need to check for and avoid duplicates in that case.
+ if (!bw.getRequirement().getNamespace().equals(BundleRevision.HOST_NAMESPACE)
+ || !reqList.contains(bw.getRequirement()))
{
- imports.add((String)
- bw.getCapability().getAttributes().get(BundleRevision.PACKAGE_NAMESPACE));
+ reqList.add(bw.getRequirement());
+ if (bw.getRequirement().getNamespace().equals(BundleRevision.PACKAGE_NAMESPACE))
+ {
+ imports.add((String)
+ bw.getCapability().getAttributes().get(BundleRevision.PACKAGE_NAMESPACE));
+ }
}
}
// Next add dynamic requirements from host.
@@ -287,7 +293,6 @@ public class BundleWiringImpl implements
}
m_resolvedCaps = Collections.unmodifiableList(capList);
-
List<R4Library> libList = (m_revision.getDeclaredNativeLibraries() == null)
? new ArrayList<R4Library>()
: new ArrayList<R4Library>(m_revision.getDeclaredNativeLibraries());