If a capability is from a fragment, we must always try to attach it to
a host even it the fragment is already resolved, since fragment capabilities
are not usable by themself. (FELIX-2858)


git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1079908 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/framework/src/main/java/org/apache/felix/framework/resolver/Candidates.java b/framework/src/main/java/org/apache/felix/framework/resolver/Candidates.java
index e1d6275..efd7ff3 100644
--- a/framework/src/main/java/org/apache/felix/framework/resolver/Candidates.java
+++ b/framework/src/main/java/org/apache/felix/framework/resolver/Candidates.java
@@ -230,17 +230,21 @@
             {
                 Capability candCap = itCandCap.next();
 
-                // If the candidate module is not resolved and not the current
-                // module we are trying to populate, then try to populate the
-                // candidate module as well.
+                // If the candidate module is a fragment, then always attempt
+                // to populate candidates for its dependency, since it must be
+                // attached to a host to be used. Otherwise, if the candidate
+                // module is not already resolved and is not the current module
+                // we are trying to populate, then populate the candidates for
+                // its dependencies as well.
                 // NOTE: Technically, we don't have to check to see if the
                 // candidate module is equal to the current module, but this
                 // saves us from recursing and also simplifies exceptions messages
                 // since we effectively chain exception messages for each level
                 // of recursion; thus, any avoided recursion results in fewer
                 // exceptions to chain when an error does occur.
-                if (!candCap.getModule().isResolved()
-                    && !candCap.getModule().equals(module))
+                if (Util.isFragment(candCap.getModule())
+                    || (!candCap.getModule().isResolved()
+                        && !candCap.getModule().equals(module)))
                 {
                     try
                     {
diff --git a/framework/src/main/java/org/apache/felix/framework/resolver/WrappedModule.java b/framework/src/main/java/org/apache/felix/framework/resolver/WrappedModule.java
index 133ebc3..59c9b7b 100644
--- a/framework/src/main/java/org/apache/felix/framework/resolver/WrappedModule.java
+++ b/framework/src/main/java/org/apache/felix/framework/resolver/WrappedModule.java
@@ -34,7 +34,6 @@
 
 class WrappedModule implements Module
 {
-    private final String m_id;
     private final Module m_module;
     private final List<Module> m_fragments;
     private List<Capability> m_cachedCapabilities = null;
@@ -42,7 +41,6 @@
 
     public WrappedModule(Module module, List<Module> fragments)
     {
-        m_id = module.getId() + " [" + super.hashCode() + "]";
         m_module = module;
         m_fragments = fragments;
     }
@@ -59,7 +57,7 @@
 
     public String getId()
     {
-        return m_id;
+        return m_module.getId();
     }
 
     public List<Capability> getCapabilities()