[MGNLUI-7106] Multivalue field in ContentEditor App fails with NPE - UI6 Created: 27/Apr/22  Updated: 19/Jul/22  Resolved: 16/May/22

Status: Closed
Project: Magnolia UI
Component/s: None
Affects Version/s: 6.2.18
Fix Version/s: 6.2.19

Type: Bug Priority: Neutral
Reporter: Carlos Cantalapiedra Assignee: Roman Kovařík
Resolution: Fixed Votes: 3
Labels: cs-bk
Σ Remaining Estimate: Not Specified Remaining Estimate: Not Specified
Σ Time Spent: Not Specified Time Spent: Not Specified
Σ Original Estimate: Not Specified Original Estimate: Not Specified

Attachments: Text File stacktrace.txt    
Issue Links:
Problem/Incident
Sub-Tasks:
Key
Summary
Type
Status
Assignee
MGNLUI-7153 PR with a fix and tests Sub-task Completed Roman Kovařík  
MGNLUI-7154 Code review & preint QA Sub-task Completed Adam Siska  
MGNLUI-7155 QA Sub-task Closed Antonín Juran  
MGNLUI-7156 Port to master (6.3) Sub-task Completed Sang Ngo Huu  
MGNLUI-7161 QA on 6.3 Sub-task Closed  
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)
Bug DoR:
[X]* Steps to reproduce, expected, and actual results filled
[X]* Affected version filled
Release notes required:
Yes
Date of First Response:
Epic Link: Nucleus Quality Maintenance
Sprint: Nucleus 10
Story Points: 2
Team: Nucleus

 Description   

When trying to include a multivalve field within a content editor block it fails when you try to save the content.

Steps to reproduce

  1. Go to demo author and open Resources app
  2. Edit content-editor/blocks/text.yaml file
  3. Include the snippet:
    content-editor/blocks/text.yaml
    [...] Rest of default block code
    assignedSegments:
      $type: jcrMultiValueField
      field:
        $type: comboBoxField
        datasource:
          $type: jcrDatasource
          workspace: website 
  1. Save it and open the Stories app
  2. Create a new story and include a Set block
  3. On the new field included on step 3, select a page
  4. Try to save the story
  5. Check it fails

Expected results

The Story is saved successfully

Actual results

An exception is thrown (check attachments for full stack trace)

Dev notes

It only happens for the multiValue field, if you include another one, e.g, a multiField, it works:

content-editor/blocks/text.yaml
[...] Rest of default block code
multi:
      i18n: true
      $type: jcrMultiField
      field:
        $type: compositeField
        properties:
          street:
            $type: textField
          city:
            i18n: true
            $type: textField


 Comments   
Comment by Roman Kovařík [ 27/Apr/22 ]

Discovery completed:

diff --git a/magnolia-ui-framework-jcr/src/main/java/info/magnolia/ui/editor/JcrPropertyProvider.java b/magnolia-ui-framework-jcr/src/main/java/info/magnolia/ui/editor/JcrPropertyProvider.java
index 687690b5b8..260e96832a 100644
--- a/magnolia-ui-framework-jcr/src/main/java/info/magnolia/ui/editor/JcrPropertyProvider.java
+++ b/magnolia-ui-framework-jcr/src/main/java/info/magnolia/ui/editor/JcrPropertyProvider.java
@@ -80,7 +80,7 @@ public class JcrPropertyProvider implements ItemProviderStrategy<Property, Node>
     @Override
     public Optional<Property> read(Node reference, Locale locale) {
         return Optional.ofNullable(Exceptions.wrap().get(() -> {
-            String propertyName = this.definition.propertyName;
+            String propertyName = this.definition.getPropertyName();
             if (!localeContext.getDefault().equals(locale)) {
                 propertyName = i18NAuthoringSupport.deriveLocalisedPropertyName(this.definition.propertyName, locale);
             }

A proxied definition has to accessed via a getter.

Generated at Mon Feb 12 09:43:11 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.