[MAGNOLIA-3035] Multivalue properties with one value become single value properties after xml export -> import Created: 26/Jan/10  Updated: 02/Dec/13  Resolved: 02/Dec/13

Status: Closed
Project: Magnolia
Component/s: core
Affects Version/s: 4.2.3
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Ernst Bunders Assignee: Philipp Bärfuss
Resolution: Not an issue Votes: 3
Labels: vpro
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
causality
is causing MAGNOLIA-3968 Improve saveHandler for multiSelect c... Closed
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:

 Description   

I found this working with (stk) categorization. A page that can have categories store uuid's to category nodes in the data workspace as a multi value property.
When you set only one category an array of one javax.jcr.Value instances will be set, and it will be a multi value property non the less. You can come back to it later and add more values.

But if you export this page to xml, it will be serialized as something like this:
<sv:property sv:name="categories" sv:type="String">
<sv:value>d7ba9d64-b7b8-4b93-8a3d-ecd14a049bb8</sv:value>
</sv:property>

This is exactly the way a single value property is stored. So when you reimport the xml, a single value property is created for this value.
When you try to add a value to it, you get:

2010-01-26 13:56:53,893 ERROR nfo.magnolia.module.admininterface.SaveHandlerImpl: Single-valued property can not be set to an array of values:
javax.jcr.ValueFormatException: Single-valued property can not be set to an array of values:property /tegenlicht/nieuws/2010/januari/wie-is-wi
at org.apache.jackrabbit.core.PropertyImpl.checkSetValue(PropertyImpl.java:244)
at org.apache.jackrabbit.core.PropertyImpl.setValue(PropertyImpl.java:646)
at org.apache.jackrabbit.core.PropertyImpl.setValue(PropertyImpl.java:629)
at info.magnolia.cms.core.DefaultNodeData.setValue(DefaultNodeData.java:504)
at info.magnolia.cms.core.DefaultContent.setNodeData(DefaultContent.java:351)
at info.magnolia.cms.util.NodeDataUtil.getOrCreateAndSet(NodeDataUtil.java:392)
.......

When you add more than one value before you export it to xml it works ok. The importer finds multiple values, and creates a multi value property accordingly.

This seems more of a jackrabbit, or even a specification bug, but perhaps it can be somehow cought in magnolia?



 Comments   
Comment by Philipp Bärfuss [ 02/Feb/10 ]

Keeping the issue open, but this somehow a jackrabbit issue

Comment by Magnolia International [ 02/Feb/10 ]

http://n4.nabble.com/Preserve-multi-value-properties-td1126162.html

Comment by Philipp Bärfuss [ 03/Aug/11 ]

We should probably expect this in info.magnolia.cms.core.DefaultNodeData.setValue(Value[]) and delete the property and re-create it if it isn't a multi value property.

Comment by Philipp Bärfuss [ 03/Aug/11 ]

Fixed in Jackrabbit 2.2.

--> https://issues.apache.org/jira/browse/JCR-2627

Comment by Stefan Baur [ 18/Mar/13 ]

Is this still an issue with magnolia 4.5.x?

Comment by Tobias Mattsson [ 02/Dec/13 ]

Not an issue ever since we switched to Jackrabbit 2.4.

Magnolia 4.5 uses Jackrabbit 2.4 and Magnolia 4.4, starting with 4.4.9, comes in a special build for Jackrabbit 2.4

Generated at Mon Feb 12 03:42:32 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.