Resolver skips mandatory resource if it previously resolved it as optional
--------------------------------------------------------------------------
Key: FELIX-3063
URL: https://issues.apache.org/jira/browse/FELIX-3063
Project: Felix
Issue Type: Bug
Components: Bundle Repository (OBR)
Affects Versions: bundlerepository-1.6.6
Reporter: Marian Grigoras
Sample setup: A imports B and C (mandatory), B imports D optionally, C imports
D mandatory.
Starting with resolving A, if the resolver happens to resolve B's dependency
first, it will mark D as a resolved *optional* dependency. Later, when
resolving C, it will skip the mandatory dependency on D, leaving the D
dependency as optional in the end.
The problem seems the be in ResolverImpl:
private boolean resolve(Resource resource, Resource[] locals, Resource[]
remotes, boolean optional)
when checking for cycles:
if (m_resolveSet.contains(resource) || m_requiredSet.contains(resource) ||
m_optionalSet.contains(resource))
{
return true;
}
This should check whether a resource previously resolved as optional has to be
solved now as non-optional. Something like:
if (m_resolveSet.contains(resource) || m_requiredSet.contains(resource)) {
return true;
} else if (m_optionalSet.contains(resource)) {
if (optional) {
// previously resolved as optional, optional now too -->
nothing to do
return true;
} else {
// previously resolved as optional, but now has to be resolved
as required --> resolve!
m_optionalSet.remove(resource);
// continue with resolving
}
}
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira