Uploaded image for project: 'Sling'
  1. Sling
  2. SLING-9774

The ValueMapUtil#merge behavior is different from the deprecated CompositeValueMap

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • API 2.23.0
    • API 2.23.4
    • None
    • None

    Description

      CompositeValueMap has been marked as deprecated and the recommendation was to replace those usages with ValueMapUtil#merge(ValueMap...)}

      Unfortunately it looks like implementation from ValueMapUtil#merge has different behavior when it comes to handling of entries in the map where the key is supplied but the value is null.

      My use case is that in a few places I have used the key=null behavior of CompositeValueMap to hide entries in a wrapped ValueMap and those uses cases don't work the same after switching to ValueMapUtil#merge(ValueMap...)}.

      To be compatible with the deprecated CompositeValueMap, the MergingValueMap#get impl should not automatically filter entries whose value is null.  Instead it should only filter when the value is null and the map does not contain the key.   A null value doesn't always mean that the map didn't have an entry for the key.

      Attachments

        Issue Links

          Activity

            People

              enorman Eric Norman
              enorman Eric Norman
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: