Uploaded image for project: 'Magnolia'
  1. Magnolia
  2. MAGNOLIA-8834

ContentMap doesn't consider the possibility that some reference options are arrays

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Neutral Neutral
    • 6.2.36
    • 6.2.29
    • None
    • None
    • Yes
    • Nucleus 38
    • 2
    • Yes

      When the ContentMap class is used for retrieve a REFERENCE property as jcr:predecessor it will fail because the get method won't consider it as multivalue.

      It would be better to include at the else if (type == PropertyType.REFERENCE) statement another check like  "if (prop.isMultiple())" so for those cases like jcr:predecessors, it won't thrown error as:

      jcr:predecessors is a multi-valued property, so it's values can only be retrieved as an array

      The groovy script to simulate the bug: scripts.getMultiReferencesProperty.xml

      Steps:

      1. Open Groovy app and import the script
      2. Open and run the script

      Actual result:

      logs:

      WARN  info.magnolia.jcr.util.ContentMap                 : Failed to retrieve jcr:predecessors on node /test with property /test/jcr:predecessors is a multi-valued property, so it's values can only be retrieved as an array 

      Expected result:

      support multivalue for jcr:predecessor propertives on ContentMap

        Acceptance criteria

              thien.quach Quach Hao Thien
              ccantalapiedra Carlos Cantalapiedra
              Nucleus
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved:
                Work Started:

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - Not Specified
                  Not Specified
                  Logged:
                  Time Spent - 2d 3h
                  2d 3h