[MAGNOLIA-8834] ContentMap doesn't consider the possibility that some reference options are arrays Created: 17/Mar/23  Updated: 18/Jun/23  Resolved: 12/Jun/23

Status: Closed
Project: Magnolia
Component/s: None
Affects Version/s: 6.2.29
Fix Version/s: 6.3.0, 6.2.36

Type: Improvement Priority: Neutral
Reporter: Carlos Cantalapiedra Assignee: Quach Hao Thien
Resolution: Fixed Votes: 0
Labels: None
Σ Remaining Estimate: Not Specified Remaining Estimate: Not Specified
Σ Time Spent: 2d 3h Time Spent: 2d 3h
Σ Original Estimate: Not Specified Original Estimate: Not Specified

Attachments: XML File scripts.getMultiReferencesProperty.xml    
Issue Links:
Problem/Incident
duplicate
is duplicated by MGNLEE-761 ContentMap#get method doesn't conside... Closed
is duplicated by MGNLEE-766 ContentMap#get method doesn't conside... Closed
is duplicated by MGNLEE-767 ContentMap#get method doesn't conside... Closed
is duplicated by MGNLEE-775 ContentMap#get method doesn't conside... Closed
Sub-Tasks:
Key
Summary
Type
Status
Assignee
MAGNOLIA-8835 Implementation Sub-task Completed Quach Hao Thien  
MAGNOLIA-8836 Review Sub-task Completed Adam Siska  
MAGNOLIA-8837 Pre-Integration QA Sub-task Closed Antonín Juran  
MAGNOLIA-8838 QA Sub-task Completed Adam Siska  
Template:
Acceptance criteria:
Empty
Task DoD:
[X]* Doc/release notes changes? Comment present?
[X]* Downstream builds green?
[X]* Solution information and context easily available?
[X]* Tests
[X]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Release notes required:
Yes
Date of First Response:
Epic Link: Nucleus Quality Maintenance
Sprint: Nucleus 38
Story Points: 2
Team: Nucleus
Work Started:
Approved:
Yes

 Description   

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



 Comments   
Comment by Quach Hao Thien [ 24/May/23 ]

Discovery

  1. Simulated and reproduced the issue with the groovy scripts.getMultiReferencesProperty.xml, and
  2. Added steps to reproduce

 

Comment by Quach Hao Thien [ 12/Jun/23 ]

Solution

ContentMap is now able to return an array of referenced node when it is called to retrieve the value of jcr:predecessors property (or whatever referenced property), which is a multiple value one

Generated at Mon Feb 12 04:36:13 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.