You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Konrad Windszus (JIRA)" <ji...@apache.org> on 2014/11/17 15:06:33 UTC

[jira] [Updated] (SLING-4178) ValueMapDecorator.convertToArray will never return null (even if type conversion does not work)

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

Konrad Windszus updated SLING-4178:
-----------------------------------
    Affects Version/s:     (was: API 2.4.2)
                       API 2.8.0

> ValueMapDecorator.convertToArray will never return null (even if type conversion does not work)
> -----------------------------------------------------------------------------------------------
>
>                 Key: SLING-4178
>                 URL: https://issues.apache.org/jira/browse/SLING-4178
>             Project: Sling
>          Issue Type: Bug
>          Components: API
>    Affects Versions: API 2.8.0
>            Reporter: Konrad Windszus
>
> Currently the {{ValueMapDecorator}} will never return {{null}} in case type conversion fails and an array type was requested.
> This is neither the case if the underlying map did not contain multiple values (and it was converted a single element array), nor if the underlying array was of a different (incompatible) type.
> For the first case a single element array with value null is returned, for the second case an array is returned which only contains null values (as many as original values).
> I would propose the following change:
> # if array was requested and underlying data is an array: return null instead of array with null items if no item could be converted to the requested array type. 
> # if array was requested and underlying data is an array: only return those items which could be converted to the requested type (leave out the others)
> # if array was requested and underlying data is not an array: return null if value could not be converted to the requested array type.
> This should still be in sync with the behaviour described in SLING-662.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)