Skip to main content
diff options
authorThomas Watson2020-02-14 16:00:16 +0000
committerThomas Watson2020-02-14 16:00:16 +0000
commit343b30273359239e30550d401b063c8e5e5e746c (patch)
parent854a5af441c11a2ba91cad2d45915f114a126fdd (diff)
Bug 559118 - Don't fail with runtime exception when substitutes are notI20200215-0600I20200214-1800
handled correctly This doesn't impact the framework, but the resolver is also registered as a service and used by others. The original fix would cause a runtime exception if no sources could be found for a blamed used capability. The previous resolver implementation would silently ignore the source and it would not impact the used class space. This still produces a valid class space according to what the resolve context is giving the resolver to work with. We will just log an info message if this happens. Change-Id: I34c61efa33a703c66763197146d09a62f09f9ad8
1 files changed, 13 insertions, 5 deletions
diff --git a/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/ b/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/
index b06d43227..6c9b278db 100755
--- a/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/
+++ b/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/
@@ -807,7 +807,7 @@ public class ResolverImpl implements Resolver
return resourcePkgs;
- private static void computeUses(
+ private void computeUses(
ResolveSession session,
Map<Resource, List<WireCandidate>> allWireCandidates,
Map<Resource, Packages> resourcePkgMap,
@@ -1016,7 +1016,7 @@ public class ResolverImpl implements Resolver
- private static void mergeUses(
+ private void mergeUses(
ResolveSession session, Resource current, Packages currentPkgs,
Capability mergeCap, List<Requirement> blameReqs, Capability matchingCap,
Map<Resource, Packages> resourcePkgMap,
@@ -1122,7 +1122,7 @@ public class ResolverImpl implements Resolver
- private static Map<Resource, Packages> calculatePackageSpaces(
+ private Map<Resource, Packages> calculatePackageSpaces(
final ResolveSession session,
final Candidates allCandidates,
Collection<Resource> hosts)
@@ -1279,7 +1279,7 @@ public class ResolverImpl implements Resolver
return uses;
- private static void addUsedBlames(
+ private void addUsedBlames(
ArrayMap<Set<Capability>, UsedBlames> usedBlames, Collection<Blame> blames, Capability matchingCap, Map<Resource, Packages> resourcePkgMap)
Set<Capability> usedCaps;
@@ -1295,7 +1295,15 @@ public class ResolverImpl implements Resolver
usedCaps.addAll(getPackageSources(blame.m_cap, resourcePkgMap));
+ if (usedCaps.isEmpty())
+ {
+ // This most likely is an issue with the resolve context.
+ // To avoid total failure we do not add blames if there is
+ // no source capabilities
+ m_logger.log(Logger.LOG_INFO,
+ "Package sources are empty for used capability: " + blames);
+ return;
+ }
// Find UsedBlame that uses the same capability as the new blame.
UsedBlames addToBlame = usedBlames.getOrCompute(usedCaps);
// Add the new Blames and record the matching capability cause

Back to the top