Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
API 2.8.0
-
None
Description
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.