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

ValueMapDecorator.convertToArray will never return null (even if type conversion does not work)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • API 2.8.0
    • API 2.11.0
    • API
    • 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:

      1. 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.
      2. 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)
      3. 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.

      Attachments

        Activity

          People

            kwin Konrad Windszus
            kwin Konrad Windszus
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: