Apply patch (FELIX-4897) to make sure fragment dynamic candidates are
properly inserted into the candidates list.


git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1680878 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/resolver/src/main/java/org/apache/felix/resolver/Candidates.java b/resolver/src/main/java/org/apache/felix/resolver/Candidates.java
index 8ab895c..9b290df 100644
--- a/resolver/src/main/java/org/apache/felix/resolver/Candidates.java
+++ b/resolver/src/main/java/org/apache/felix/resolver/Candidates.java
@@ -589,13 +589,15 @@
         // as a mandatory revision.
         m_mandatoryResources.add(resource);
 
-        // Add the dynamic imports candidates.
-        add(req, candidates);
-
         // Process the candidates, removing any candidates that
         // cannot resolve.
         ResolutionException rethrow = processCandidates(rc, resource, candidates);
 
+        // Add the dynamic imports candidates.
+        // Make sure this is done after the call to processCandidates since we want to ensure
+        // fragment candidates are properly hosted before adding the candidates list which makes a copy
+        add(req, candidates);
+
         if (candidates.isEmpty())
         {
             if (rethrow == null)