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

MultiValueJSONTransformer - NPE

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • Neutral
    • None
    • 5.1
    • None

    Description

      read from item method in MultiValueJSONTransformer should check for null before proceeding

      this code:

          public PropertysetItem readFromItem() {
              PropertysetItem newValues = new PropertysetItem();
      
              Property<String> property = getOrCreateProperty(String.class);
              String value = property.getValue();
              List<String> list = Arrays.asList(value.split(","));
              int position = 0;
              for (String element : list) {
                  newValues.addItemProperty(position, new DefaultProperty(element));
                  position += 1;
              }
              return newValues;
          }
      

      should be something like this:

          public PropertysetItem readFromItem() {
              PropertysetItem newValues = new PropertysetItem();
      
              Property<String> property = getOrCreateProperty(String.class);
              String value = property.getValue();
              if (value == null)
                 return null;
              List<String> list = Arrays.asList(value.split(","));
              int position = 0;
              for (String element : list) {
                  newValues.addItemProperty(position, new DefaultProperty(element));
                  position += 1;
              }
              return newValues;
          }
      

      Checklists

        Acceptance criteria

        Attachments

          Issue Links

            Activity

              People

                fgrilli Federico Grilli
                rulate Ricardo Ulate
                Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved:

                  Checklists

                    Bug DoR
                    Task DoD