Apply patch (FELIX-4524) to fix index out of bounds exception.


git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1597999 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 d22ffc4..61fa97b 100644
--- a/resolver/src/main/java/org/apache/felix/resolver/Candidates.java
+++ b/resolver/src/main/java/org/apache/felix/resolver/Candidates.java
@@ -476,13 +476,26 @@
                                     break;
                             }
                         }
+                        if (candidates.isEmpty())
+                        {
+                            if (Util.isOptional(dependent))
+                            {
+                                clearCandidates(dependent);
+                            }
+                            else
+                            {
+                                String msg = "Unable to resolve " + dependent.getResource()
+                                        + ": missing requirement " + dependent;
+                                throw new ResolutionException(msg, null, Collections.singleton(dependent));
+                            }
+                        }
                     }
                 }
             }
         }
     }
 
-    private boolean isSubstituted(Capability substitutableCap, Map<Capability, Integer> substituteStatuses) throws ResolutionException
+    private boolean isSubstituted(Capability substitutableCap, Map<Capability, Integer> substituteStatuses)
     {
         Integer substituteState = substituteStatuses.get(substitutableCap);
         if (substituteState == null)