You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by stephan lohwasser <st...@systemone.at> on 2006/06/12 18:33:33 UTC

session.move() error: ItemExistsException despite same name siblings

hello all,

i have a problem moving nodes:
i am trying to move one 'element' node from one 'page' to another 'page'.
elements are always stored below the pages 'element root node'.

the elements are same name siblings below the element root and support 
ordering.
here is the nodetypes.xml excerpt:
<!-- element root definition -->
<nodeType hasOrderableChildNodes="true" isMixin="false" 
name="s1NT:elementRoot">
    [..]
    <childNodeDefinition autoCreated="false" 
defaultPrimaryType="s1NT:element" mandatory="false"
                         name="s1:element" onParentVersion="COPY" 
protected="false" sameNameSiblings="true" hasOrderableChildNodes="true">
        <requiredPrimaryTypes>
            <requiredPrimaryType>s1NT:element</requiredPrimaryType>
        </requiredPrimaryTypes>
    </childNodeDefinition>
</nodeType>

<!-- element definition -->
<nodeType hasOrderableChildNodes="true" isMixin="false" name="s1NT:element">
    [..]
</nodeType>

i do already have 3 same-name-siblings at the destination position:
18:15:05,047 INFO  [ElementFactoryImpl] 
/s1:root/s1:pages/s1:page[3]/s1:elementRoot/s1:element
18:15:05,047 INFO  [ElementFactoryImpl] 
/s1:root/s1:pages/s1:page[3]/s1:elementRoot/s1:element[2]
18:15:05,047 INFO  [ElementFactoryImpl] 
/s1:root/s1:pages/s1:page[3]/s1:elementRoot/s1:element[3]

when i call session.move(srcPath, destPath), with srcPath being: 
/s1:root/s1:pages/s1:page[4]/s1:elementRoot/s1:element and destPath 
being /s1:root/s1:pages/s1:page[3]/s1:elementRoot/s1:element,  trying to 
move the first element below page[4] to the end of the elments of 
page[3], i get the following logs:
18:15:05,047 INFO  [ElementFactoryImpl] moving 
/s1:root/s1:pages/s1:page[4]/s1:elementRoot/s1:element to 
/s1:root/s1:pages/s1:page[3]/s1:elementRoot/s1:element
18:15:05,047 ERROR [S1SessionImpl] javax.jcr.ItemExistsException: 
/s1:root/s1:pages/s1:page[3]/s1:elementRoot/s1:element.

do i have any errors in my code or nodetypes xml? the javadocs say this 
happens if i do not have same name siblings, but this can hardly be the 
problem.
thanks a lot
stephan




Re: session.move() error: ItemExistsException despite same name siblings

Posted by Stefan Guggisberg <st...@gmail.com>.
hi stephan,
i verified that this is a bug and created a jira issue for it:
http://issues.apache.org/jira/browse/JCR-458

thanks for reporting this issue,
stefan

On 6/12/06, stephan lohwasser <st...@systemone.at> wrote:
> hello all,
>
> i have a problem moving nodes:
> i am trying to move one 'element' node from one 'page' to another 'page'.
> elements are always stored below the pages 'element root node'.
>
> the elements are same name siblings below the element root and support
> ordering.
> here is the nodetypes.xml excerpt:
> <!-- element root definition -->
> <nodeType hasOrderableChildNodes="true" isMixin="false"
> name="s1NT:elementRoot">
>     [..]
>     <childNodeDefinition autoCreated="false"
> defaultPrimaryType="s1NT:element" mandatory="false"
>                          name="s1:element" onParentVersion="COPY"
> protected="false" sameNameSiblings="true" hasOrderableChildNodes="true">
>         <requiredPrimaryTypes>
>             <requiredPrimaryType>s1NT:element</requiredPrimaryType>
>         </requiredPrimaryTypes>
>     </childNodeDefinition>
> </nodeType>
>
> <!-- element definition -->
> <nodeType hasOrderableChildNodes="true" isMixin="false" name="s1NT:element">
>     [..]
> </nodeType>
>
> i do already have 3 same-name-siblings at the destination position:
> 18:15:05,047 INFO  [ElementFactoryImpl]
> /s1:root/s1:pages/s1:page[3]/s1:elementRoot/s1:element
> 18:15:05,047 INFO  [ElementFactoryImpl]
> /s1:root/s1:pages/s1:page[3]/s1:elementRoot/s1:element[2]
> 18:15:05,047 INFO  [ElementFactoryImpl]
> /s1:root/s1:pages/s1:page[3]/s1:elementRoot/s1:element[3]
>
> when i call session.move(srcPath, destPath), with srcPath being:
> /s1:root/s1:pages/s1:page[4]/s1:elementRoot/s1:element and destPath
> being /s1:root/s1:pages/s1:page[3]/s1:elementRoot/s1:element,  trying to
> move the first element below page[4] to the end of the elments of
> page[3], i get the following logs:
> 18:15:05,047 INFO  [ElementFactoryImpl] moving
> /s1:root/s1:pages/s1:page[4]/s1:elementRoot/s1:element to
> /s1:root/s1:pages/s1:page[3]/s1:elementRoot/s1:element
> 18:15:05,047 ERROR [S1SessionImpl] javax.jcr.ItemExistsException:
> /s1:root/s1:pages/s1:page[3]/s1:elementRoot/s1:element.
>
> do i have any errors in my code or nodetypes xml? the javadocs say this
> happens if i do not have same name siblings, but this can hardly be the
> problem.
> thanks a lot
> stephan
>
>
>
>