Uploaded image for project: 'Magnolia UI'
  1. Magnolia UI
  2. MGNLUI-1791

Suspicious handling of null selection in ListViewImpl

    XMLWordPrintable

Details

    • Bug
    • Resolution: Outdated
    • Neutral
    • None
    • 5.0
    • None
    • None

    Description

      The ValueChangeListener in ListViewImpl creates a Set of size 1 containing the null value and then passes this Set to its listener, AbstractContentPresenter#onItemSelection. It expects to be given a Set of zero elements when nothing is selected.

      The code should be changed to:

                          Set<String> items;
                          if (value instanceof Set) {
                              items = (Set<String>) value;
                          } else {
                              items = new LinkedHashSet<String>();
                              if (value != null) {
                                  items.add((String) value);
                              }
                          }
                          listener.onItemSelection(items);
      

      We need to be make sure this doesn't have side effects elsewhere. Because the set is later passed to setSelectedItemIds() and a ContentChangedEvent is sent containing jcr item adapters, this is probably also a collection of size 1 containing null.

      Checklists

        Acceptance criteria

        Attachments

          Activity

            People

              Unassigned Unassigned
              tmattsson Tobias Mattsson
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Checklists

                  Bug DoR
                  Task DoD