You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Sridhar Raman <sr...@gmail.com> on 2007/03/28 08:17:52 UTC

Problem with session.move

I am using session.move() for renaming nodes.  This is the problem I face.
I have a node at this path: /CONTENT/ENTITIES/ABC [1]
Note: The [1] is not the index of the node, but the actual node name.  That
is, I escape the box brackets and import the XML file, and the node gets
created.  The node name in the XML file would be this -
ABC_x0020__x005B_1_x005D_

Now, I want to move this node from its existing path to a new path:
/CONTENT/ERRENTITIES/ABC [1]

How do I do it?

If I give the escaped node name in the session.move parameters, I get a
PathNotFound exception.  If I give the path as it is, I get an
"/CONTENT/ENTITIES/ABC [1]: invalid path " exception.

What is the solution to this?

Thanks in advance,
Sridhar

Re: Problem with session.move

Posted by Stefan Guggisberg <st...@gmail.com>.
hi sridhar,

On 3/28/07, Sridhar Raman <sr...@gmail.com> wrote:
> I am using session.move() for renaming nodes.  This is the problem I face.
> I have a node at this path: /CONTENT/ENTITIES/ABC [1]
> Note: The [1] is not the index of the node, but the actual node name.  That
> is, I escape the box brackets and import the XML file, and the node gets
> created.  The node name in the XML file would be this -
> ABC_x0020__x005B_1_x005D_
>
> Now, I want to move this node from its existing path to a new path:
> /CONTENT/ERRENTITIES/ABC [1]
>
> How do I do it?
>
> If I give the escaped node name in the session.move parameters, I get a
> PathNotFound exception.  If I give the path as it is, I get an
> "/CONTENT/ENTITIES/ABC [1]: invalid path " exception.

the xml element ABC_x0020__x005B_1_x005D_ got imported as
"ABC [1]" which is an illegal name and therefore a bug.

i created a jira issue:
https://issues.apache.org/jira/browse/JCR-821

>
> What is the solution to this?

if possible try to avoid using characters that lead to illegal jcr names.
square brackets are reserved in jcr as they're used for the index notation.
for more details please refer to "4.6 Path Syntax" in the jsr 170 specification.

cheers
stefan

>
> Thanks in advance,
> Sridhar
>