[MGNLPN-502] Previewing traits Using MultiValue Fields Give ClassCastException Created: 01/May/20  Updated: 09/Dec/21  Resolved: 08/Dec/21

Status: Closed
Project: Magnolia Personalization
Component/s: None
Affects Version/s: 2.0
Fix Version/s: 2.1.1, 2.0.13

Type: Bug Priority: Neutral
Reporter: Julian Nodarse Assignee: Antonín Juran
Resolution: Fixed Votes: 1
Labels: 62-UI-2, VN-Maintenance, maintenance, ui-team-support
Remaining Estimate: 7m
Time Spent: 1d 3.4h
Original Estimate: Not Specified

Attachments: Java Source File CustomList.java     Java Source File CustomListConverter.java     Java Source File CustomListVoter.java     XML File config.modules.myexample.traits.customlist-example-older.xml     XML File config.modules.myexample.traits.customlist-example.xml    
Issue Links:
Relates
relates to MGNLUI-6280 DEV DOC: Investigate Personalization ... Closed
causality
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
Date of First Response:
Epic Link: Migrate apps to new UI framework
Sprint: UI FW 38, Pages Maintenance 1, Pages Maintenance 2
Story Points: 8

 Description   

There is an issue with MultiValue fields being used within traits and the Preview App. User receives following error when adding a value to the field:

Failed to dispatch context property change: java.util.LinkedHashMap cannot be cast to javax.jcr.Node
java.lang.ClassCastException: java.util.LinkedHashMap cannot be cast to javax.jcr.Node

I have tested this on 6.1 and 6.2 and had different results. With 6.1 , I was able to add more Items to my MultiValue field and had no errors. On 6.2, I used two different configurations, one was with the old MultiValue names (i.e.info.magnolia.ui.form.field.definition.MultiValueFieldDefinition) and its respective configs, the other was with info.magnolia.ui.field.JcrMultiFieldDefinition.

With the older config, I was able to add more Items to my list, but the above error kept showing. When using the new class name (JcrMultFieldDefinition), the error showed as well.

I have attached the configs I have used for both 6.1 and 6.2 along with their converter, voter and trait class.

 

Dev notes

We could bind to this map via JCR API - expose map as a mocked JCR node instead of LinkedHashMap 



 Comments   
Comment by Thomas Duffey [ 12/Feb/21 ]

In case not clear when this gets fixed we need it to work within the Pages V7 (Compatibility) app as well.

Comment by Roman Kovařík [ 13/Oct/21 ]

Reopened: valueField is used also in JCR based personas app and the new field doesn't work in JCR (thx asiska).

Comment by Roman Kovařík [ 16/Nov/21 ]

For the record, there is a PoC https://git.magnolia-cms.com/projects/ENTERPRISE/repos/personalization/pull-requests/339/overview including a docu update https://git.magnolia-cms.com/projects/DOCUMENTATION/repos/product-docs/pull-requests/660/overview

Generated at Mon Feb 12 06:38:16 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.