Uploaded image for project: 'Jackrabbit Content Repository'
  1. Jackrabbit Content Repository
  2. JCR-908

Unable to properly restore a previous version of a node that contains multivalue properties.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.3, 1.4, 1.5
    • None
    • jackrabbit-core
    • None

    Description

      An ArrayIndexOutOfBoundsException occurs when I am trying to restore a previous version of a node when it contains empty multi value properties.

      Here is a stack trace for where in he core code the exception is occurring:

      Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 0
      at org.apache.jackrabbit.core.NodeImpl.restoreFrozenState(NodeImpl.java:3856)
      at org.apache.jackrabbit.core.NodeImpl.internalRestore(NodeImpl.java:3799)
      at org.apache.jackrabbit.core.NodeImpl.internalRestore(NodeImpl.java:3760)
      at org.apache.jackrabbit.core.NodeImpl.restore(NodeImpl.java:3057)
      ...

      Line 3856 in NodeImpl.restoreFrozenState is:

      internalSetProperty(props[i].getName(), prop.getValues()[0]);

      This is always being called even for multivalued properties (the previous "if (prop.isMultiValued())" is always returning false). Even if I have a value in the multi-value property, only the first item is restored because the prop.isMultiValued() call in NodeImpl.restoreFrozenState() never returns true regardless of whether the property is multivalued or not.

      The node definition is:

      <nodeType name="bob:customType"
      isMixin="false"
      hasOrderableChildNodes="false"
      primaryItemName="">
      <supertypes>
      <supertype>mix:lockable</supertype>
      <supertype>mix:versionable</supertype>
      </supertypes>
      <propertyDefinition name="bob:properties"
      requiredType="Reference"
      autoCreated="false"
      mandatory="true"
      onParentVersion="COPY"
      protected="false"
      multiple="true"/>
      </nodeType>

      A new node is created with the primary type being "bob:customType" and an empty array of References is set as the value for that property in the node.

      Attachments

        Activity

          People

            Unassigned Unassigned
            bobwieler Bob Wieler
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: