Uploaded image for project: 'Felix'
  1. Felix
  2. FELIX-4989

CopyOnWriteList.removeAll(Collection<?>) is incorrect causing failures for multiple cardinality resolution

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • resolver-1.6.0
    • Resolver
    • None
    • All

    Description

      The method org.apache.felix.resolver.Candidates.clearCandidates(Requirement, Collection<Capability>) uses the List.removeAll method which is backed by the org.apache.felix.resolver.util.CopyOnWriteList.removeAll(Collection<?>) implementation.

      clearCandidates is used when a requirement has multiple cardinality and some subset of candidates causes a uses constraint violation. The clearCandidates method will remove the offending capabilities as long as there is at least one remaining capability that does not cause a uses constraint violation. The issue is the CopyOnWriteList.removeAll is not correct. If the last element in the list is the only element to be removed then the logic ends up removing all elements (by constructing and empty data array).

      Attachments

        1. CopyOnWriteList.patch
          0.8 kB
          Tom Watson

        Activity

          People

            gnodet Guillaume Nodet
            tjwatson Tom Watson
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: