Make sure capabilities from resolved singleton bundles are properly
indexed. (FELIX-3137)
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1176962 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/framework/src/main/java/org/apache/felix/framework/StatefulResolver.java b/framework/src/main/java/org/apache/felix/framework/StatefulResolver.java
index 22f81dd..cea167e 100644
--- a/framework/src/main/java/org/apache/felix/framework/StatefulResolver.java
+++ b/framework/src/main/java/org/apache/felix/framework/StatefulResolver.java
@@ -928,12 +928,19 @@
m_revisions.add(br);
- if (Util.isSingleton(br))
+ // Add singletons to the singleton map.
+ boolean isSingleton = Util.isSingleton(br);
+ if (isSingleton)
{
// Index the new singleton.
addToSingletonMap(m_singletons, br);
}
- else
+
+ // We always need to index non-singleton bundle capabilities, but
+ // singleton bundles only need to be index if they are resolved.
+ // Unresolved singleton capabilities are only indexed before a
+ // resolve operation when singleton selection is performed.
+ if (!isSingleton || (br.getWiring() != null))
{
if (Util.isFragment(br))
{