The TCK has changed to verify that bundles do not depend on themselves,
so we filter that case now. We might want to consider modifying the module
layer to not create wires from modules to themself.
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@606010 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/framework/src/main/java/org/apache/felix/framework/Felix.java b/framework/src/main/java/org/apache/felix/framework/Felix.java
index 3db400e..e72eade 100644
--- a/framework/src/main/java/org/apache/felix/framework/Felix.java
+++ b/framework/src/main/java/org/apache/felix/framework/Felix.java
@@ -3110,19 +3110,24 @@
IModule[] depModules = ((ModuleImpl) expModules[expIdx]).getDependents();
for (int depIdx = 0; (depModules != null) && (depIdx < depModules.length); depIdx++)
{
- // See if the dependent module has a wire for the specific
- // package. If so, see if the provider module is from the
- // exporter and record it if it is.
- IWire wire = Util.getWire(depModules[depIdx], ep.getName());
- if ((wire != null) && expModules[expIdx].equals(wire.getExporter()) &&
- wire.getRequirement().isSatisfied(
- new Capability(ICapability.PACKAGE_NAMESPACE, null, new R4Attribute[] {
- new R4Attribute(ICapability.PACKAGE_PROPERTY, ep.getName(), false),
- new R4Attribute(ICapability.VERSION_PROPERTY, ep.getVersion(), false)
- })))
+ // ExportedPackage.getImportingBundles() does not expect bundles
+ // to depend on themselves, so we will filter that case here.
+ if (!expModules[expIdx].equals(depModules[depIdx]))
{
- // Add the bundle to the list of importers.
- list.add(getBundle(Util.getBundleIdFromModuleId(depModules[depIdx].getId())));
+ // See if the dependent module has a wire for the specific
+ // package. If so, see if the provider module is from the
+ // exporter and record it if it is.
+ IWire wire = Util.getWire(depModules[depIdx], ep.getName());
+ if ((wire != null) && expModules[expIdx].equals(wire.getExporter()) &&
+ wire.getRequirement().isSatisfied(
+ new Capability(ICapability.PACKAGE_NAMESPACE, null, new R4Attribute[] {
+ new R4Attribute(ICapability.PACKAGE_PROPERTY, ep.getName(), false),
+ new R4Attribute(ICapability.VERSION_PROPERTY, ep.getVersion(), false)
+ })))
+ {
+ // Add the bundle to the list of importers.
+ list.add(getBundle(Util.getBundleIdFromModuleId(depModules[depIdx].getId())));
+ }
}
}
}