Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
resolver-1.0.0
-
None
Description
In Candidates there are two places where ResolveContext.insertHostedCapability is called:
- org.apache.felix.resolver.Candidates.prepare(ResolveContext)
- org.apache.felix.resolver.Candidates.processCandidates(ResolveContext, Resource, List<Capability>)
In the prepare method the actual fragment capability is correctly removed as a candidate when inserting the hosted capability:
List<Capability> original = ((ShadowList) cands).getOriginal();
int removeIdx = original.indexOf(origCap);
if (removeIdx != -1)
But in the processCandidates method this is not the case. This can lead to invalid Wires being created where the fragment resource is the provider. This happens if the hosted capability introduces a class space inconsistency (from uses constraints). In this case we move on to the next candidate which may be the fragment capability (depending on how the ResolveContext sorts).
The fix is simple, just remove the original fragment capability from the candidate list. I fixed this in equinox with commit: