You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Eric Norman (Jira)" <ji...@apache.org> on 2020/09/28 02:46:00 UTC

[jira] [Resolved] (SLING-9774) The ValueMapUtil#merge behavior is different from the deprecated CompositeValueMap

     [ https://issues.apache.org/jira/browse/SLING-9774?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Eric Norman resolved SLING-9774.
--------------------------------
    Resolution: Fixed

Fixed at: [https://github.com/apache/sling-org-apache-sling-api/commit/ebe211f16cc8d7ca6f1c61c9338674d8fcc99ad6]

Also added a new unit test to guard against future regressions.

> The ValueMapUtil#merge behavior is different from the deprecated CompositeValueMap
> ----------------------------------------------------------------------------------
>
>                 Key: SLING-9774
>                 URL: https://issues.apache.org/jira/browse/SLING-9774
>             Project: Sling
>          Issue Type: Bug
>    Affects Versions: API 2.23.0
>            Reporter: Eric Norman
>            Assignee: Eric Norman
>            Priority: Major
>             Fix For: API 2.23.2
>
>
> 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.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)