Uploaded image for project: 'Magnolia'
  1. Magnolia
  2. MAGNOLIA-3035

Multivalue properties with one value become single value properties after xml export -> import

    XMLWordPrintable

Details

    • Bug
    • Resolution: Not an issue
    • Major
    • None
    • 4.2.3
    • core

    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?

      Checklists

        Acceptance criteria

        Attachments

          Issue Links

            Activity

              People

                pbaerfuss Philipp Bärfuss
                ebunders Ernst Bunders
                Votes:
                3 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved:

                  Checklists

                    Bug DoR
                    Task DoD