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

WrappedResource does not handle namespace correctly

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • resolver-1.8.0
    • resolver-1.10.0
    • Resolver
    • None

    Description

      This is similar to FELIX-4727. There are several issues with how namespace is handled in getCapabilities and getRequirements for the org.apache.felix.resolver.WrappedResource class

      In getCapabilities the namespace is correctly used to ask the host and fragment resources for the named capabilities. But then that list is saved into the m_cachedCapabilities field. If you first ask for the 'foo' namespace it will save all the 'foo' capabilities to m_cachedCapabilities, then if you ask for the 'bar' capabilities it will simply return the m_cachedCapabilities from before with 'foo' capabilities.

      In getRequirements the namespace is completely ignored. I think there are several reasons to stop lazily crating these caches. It leads to strange bugs like the ones above, but also there is no synchronization here and the var is not volatile so I think there could be some issues with multi-threading. Now that the resolver is multi-threaded I think we should stop creating these lists of capabilities and requirements lazily. Instead I think we should make them final and create them in the constructor.

      Attachments

        1. FELIX-5166.patch
          6 kB
          Tom Watson

        Activity

          People

            tjwatson Tom Watson
            tjwatson Tom Watson
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: