[CONTEDIT-474] Block dialog: jcrMultiValueField causes NullPointerException when saving story Created: 24/Feb/22  Updated: 05/Sep/22  Resolved: 05/Sep/22

Status: Closed
Project: Content Editor
Component/s: None
Affects Version/s: 2.0.1, 2.0.3
Fix Version/s: None

Type: Improvement Priority: Critical
Reporter: wolf bubenik Assignee: Adrian Brooks
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Magnolia 6.2.15
Java11


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)
Documentation update required:
Yes
Date of First Response:
Epic Link: AuthorX Support
Sprint: AuthX 17
Story Points: 0.5
Team: AuthorX

 Description   

Crate a custom block with a jcrMultiValueField:

class: info.magnolia.block.BlockDefinition
templateId: es-playground-main:blocks/tokenFilters/noRenderingTemplate
icon: text-block
block:
  properties:
    synonyms:
      label: Synonyms
      $type: jcrMultiValueField
      buttonSelectAddLabel: Add synonyms
      field:
        $type: textField 

and create a storries app where this block is allowed.

Create a story using this block

save.

Ont he console you see the stack trace:

[INFO] [talledLocalContainer] 2022-02-24 15:18:36,716 ERROR nolia.ui.contentapp.browser.ActionExecutionService: An error occurred while executing action [commit]
[INFO] [talledLocalContainer] info.magnolia.ui.api.action.ActionExecutionException: Action execution failed for action: commit
[INFO] [talledLocalContainer]     at info.magnolia.ui.api.action.AbstractActionExecutor.execute(AbstractActionExecutor.java:64) ~[magnolia-ui-api-6.2.15.jar:?]
[INFO] [talledLocalContainer]     at info.magnolia.ui.contentapp.browser.ActionExecutionService.executeAction(ActionExecutionService.java:70) ~[magnolia-ui-framework-6.2.15.jar:?]
[INFO] [talledLocalContainer]     at info.magnolia.ui.framework.action.service.CompatibilityActionExecutionService.executeAction(CompatibilityActionExecutionService.java:129) ~[magnolia-ui-framework-compatibility-6.2.15.jar:?]
[INFO] [talledLocalContainer]     at info.magnolia.ui.dialog.ActionExecution.execute(ActionExecution.java:72) ~[magnolia-ui-framework-6.2.15.jar:?]
[INFO] [talledLocalContainer]     at info.magnolia.ui.dialog.ActionButton.lambda$new$d31ec881$1(ActionButton.java:63) ~[magnolia-ui-framework-6.2.15.jar:?]
[INFO] [talledLocalContainer]     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
.....
[INFO] [talledLocalContainer] Caused by: java.lang.NullPointerException: Cannot invoke "String.startsWith(String)" because "path" is null
[INFO] [talledLocalContainer]     at org.apache.jackrabbit.spi.commons.conversion.CachingPathResolver.getQPath(CachingPathResolver.java:93) ~[jackrabbit-spi-commons-2.20.4.jar:?]
[INFO] [talledLocalContainer]     at org.apache.jackrabbit.spi.commons.conversion.CachingPathResolver.getQPath(CachingPathResolver.java:77) ~[jackrabbit-spi-commons-2.20.4.jar:?]
[INFO] [talledLocalContainer]     at org.apache.jackrabbit.spi.commons.conversion.DefaultNamePathResolver.getQPath(DefaultNamePathResolver.java:82) ~[jackrabbit-spi-commons-2.20.4.jar:?]
[INFO] [talledLocalContainer]     at org.apache.jackrabbit.core.SessionImpl.getQPath(SessionImpl.java:650) ~[jackrabbit-core-2.20.4.jar:2.20.4]
[INFO] [talledLocalContainer]     at org.apache.jackrabbit.core.session.SessionContext.getQPath(SessionContext.java:338) ~[jackrabbit-core-2.20.4.jar:2.20.4]
[INFO] [talledLocalContainer]     at org.apache.jackrabbit.core.NodeImpl.resolveRelativePath(NodeImpl.java:238) ~[jackrabbit-core-2.20.4.jar:2.20.4]
[INFO] [talledLocalContainer]     at org.apache.jackrabbit.core.NodeImpl.resolveRelativePropertyPath(NodeImpl.java:204) ~[jackrabbit-core-2.20.4.jar:2.20.4]
[INFO] [talledLocalContainer]     at org.apache.jackrabbit.core.NodeImpl.hasProperty(NodeImpl.java:2458) ~[jackrabbit-core-2.20.4.jar:2.20.4]
[INFO] [talledLocalContainer]     at info.magnolia.jcr.wrapper.DelegateNodeWrapper.hasProperty(DelegateNodeWrapper.java:304) ~[magnolia-core-6.2.15.jar:?]
[INFO] [talledLocalContainer]     at info.magnolia.jcr.wrapper.DelegateNodeWrapper.hasProperty(DelegateNodeWrapper.java:304) ~[magnolia-core-6.2.15.jar:?]
[INFO] [talledLocalContainer]     at info.magnolia.jcr.wrapper.DelegateNodeWrapper.hasProperty(DelegateNodeWrapper.java:304) ~[magnolia-core-6.2.15.jar:?]
[INFO] [talledLocalContainer]     at info.magnolia.jcr.wrapper.DelegateNodeWrapper.hasProperty(DelegateNodeWrapper.java:304) ~[magnolia-core-6.2.15.jar:?]
[INFO] [talledLocalContainer]     at info.magnolia.jcr.wrapper.DelegateNodeWrapper.hasProperty(DelegateNodeWrapper.java:304) ~[magnolia-core-6.2.15.jar:?]
[INFO] [talledLocalContainer]     at info.magnolia.jcr.wrapper.DelegateNodeWrapper.hasProperty(DelegateNodeWrapper.java:304) ~[magnolia-core-6.2.15.jar:?]
[INFO] [talledLocalContainer]     at info.magnolia.ui.editor.JcrPropertyProvider.lambda$read$0(JcrPropertyProvider.java:88) ~[magnolia-ui-framework-jcr-6.2.15.jar:?]
[INFO] [talledLocalContainer]     at com.machinezoo.noexception.CheckedExceptionHandler.get(CheckedExceptionHandler.java:1737) ~[noexception-1.4.4.jar:?]
[INFO] [talledLocalContainer]     at info.magnolia.ui.editor.JcrPropertyProvider.read(JcrPropertyProvider.java:82) ~[magnolia-ui-framework-jcr-6.2.15.jar:?]
[INFO] [talledLocalContainer]     at info.magnolia.ui.editor.JcrPropertyProvider.read(JcrPropertyProvider.java:58) ~[magnolia-ui-framework-jcr-6.2.15.jar:?]
[INFO] [talledLocalContainer]     at info.magnolia.ui.editor.FormView.lambda$null$8(FormView.java:159) ~[magnolia-ui-framework-6.2.15.jar:?]
[INFO] [talledLocalContainer]     at java.util.HashMap.forEach(HashMap.java:1425) ~[?:?]
.....

Other dialog fields work fine.



 Comments   
Comment by Jesus Alonso [ 14/Mar/22 ]

Hello wolf.bubenik , the datasource attribute is required for the jcrMultiValueField type -> https://docs.magnolia-cms.com/product-docs/6.2/Templating/Dialog-definition/Field-definition/List-of-fields/Multi-field.html. Please ensure you have added it to your block.

Comment by wolf bubenik [ 15/Mar/22 ]

Hallo Jesus Alonso, thanks for pointing this out. I overlooked that the datasource is required even if I don't need it (no select options). However, I would consider this as a "chance for improvement"

Comment by Adrian Brooks [ 05/Sep/22 ]

Documentation updated here: https://docs.magnolia-cms.com/product-docs/6.2/Developing/Templating/Dialog-definition/Field-definition/List-of-fields/Multi-field.html#_common_multi_field_properties

Generated at Mon Feb 12 00:20:47 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.