When attempting to find a candidate for a dynamic import, we should try to
find the first candidate that can be resolved; the code was incorrectly
trying to resolve the importing module instead of the candidate module.


git-svn-id: https://svn.apache.org/repos/asf/incubator/felix/trunk@431942 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4SearchPolicyCore.java b/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4SearchPolicyCore.java
index 0e264b0f..53c9681 100755
--- a/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4SearchPolicyCore.java
+++ b/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4SearchPolicyCore.java
@@ -401,7 +401,7 @@
                 }
 
                 // If there were no "in use" candidates, then try "available"
-                // candidates.
+                // candidates and take the first one that can resolve.
                 if (candidate == null)
                 {
                     candidates = getAvailableExporters(impMatch, false);
@@ -411,7 +411,7 @@
                     {
                         try
                         {
-                            resolve(module);
+                            resolve(candidates[candIdx]);
                             candidate = candidates[candIdx];
                         }
                         catch (ResolveException ex)