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

                 Key: JCR-908
                 URL: https://issues.apache.org/jira/browse/JCR-908
             Project: Jackrabbit
          Issue Type: Bug
          Components: core
    Affects Versions: 1.3
            Reporter: Bob Wieler


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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to