You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by hsp <pi...@ibest.com.br> on 2014/05/09 14:55:11 UTC

javax.jcr.PathNotFoundException for node with character '|' in name

Hi;

There is a node in our repository, with name "My |ndex".
I can't get this node by path, just raise the
javax.jcr.PathNotFoundException.
I have tried with Text.escapeIllegalJcrChars("My |ndex") without sucess
(after escape it will be as "My %7ndex").
Now, Is there a way to move (rename) such node, or at least delete it?

Regards
Helio.



--
View this message in context: http://jackrabbit.510166.n4.nabble.com/javax-jcr-PathNotFoundException-for-node-with-character-in-name-tp4660829.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.

Re: javax.jcr.PathNotFoundException for node with character '|' in name

Posted by hsp <pi...@ibest.com.br>.
Tobias,

I am saying that:

session.getNode("My |ndex")

is throwing javax.jcr.PathNotFoundException

But, in xpath searches it returns in iterator (but it is another service).

So, I can't get the node to rename it...

Regards,
Helio.



--
View this message in context: http://jackrabbit.510166.n4.nabble.com/javax-jcr-PathNotFoundException-for-node-with-character-in-name-tp4660829p4660834.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.

Re: javax.jcr.PathNotFoundException for node with character '|' in name

Posted by hsp <pi...@ibest.com.br>.
Tobias;

Ok, I will try to run such kind script directly in server environment. I
know about these spec, but I think was caused by some batch import long time
ago, these nodes are there since jack 1.0, it was a surprise for me too...

Thanks by your hints!

Helio.



--
View this message in context: http://jackrabbit.510166.n4.nabble.com/javax-jcr-PathNotFoundException-for-node-with-character-in-name-tp4660829p4660839.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.

Re: javax.jcr.PathNotFoundException for node with character '|' in name

Posted by Tobias Bocanegra <tr...@day.com>.
Hi,

well, '|' is an invalid character by the JCR spec:

InvalidChar ::= '/' | ':' | '[' | ']' | '|' | '*'

so I wonder how you created this node :-)
but maybe you can iterate over the childnodes, do a string-compare of
the name and then do a node.remove(), eg:

for (NodeIterator iter = session.getRootNode().getNodes(); iter.hasNext();) {
  Node child = iter.nextNode();
  if (child.getName().equals("My |index")) child.remove();
}
session.save();


regards, toby



On Mon, May 12, 2014 at 2:24 PM, hsp <pi...@ibest.com.br> wrote:
> Tobias,
>
> In
> ...core...SessionItemOperation
>  /**
>      * Performs this operation on the specified item. This method resolves
>      * the given absolute path and calls the abstract
>      * {@link #perform(ItemManager, Path)} method to actually perform the
>      * selected operation.
>      *
>      * @throws RepositoryException if the operation fails
>      */
>     public T perform(SessionContext context) throws RepositoryException
> ...
>  Path normalized = context.getQPath(path).getNormalizedPath();
> ...
>
> org.apache.jackrabbit.spi.commons.conversion.MalformedPathException: '/My
> |ndex' is not a valid path. '|' not a valid name character.
>
> Regards,
>
> Helio.
>
>
>
> --
> View this message in context: http://jackrabbit.510166.n4.nabble.com/javax-jcr-PathNotFoundException-for-node-with-character-in-name-tp4660829p4660835.html
> Sent from the Jackrabbit - Users mailing list archive at Nabble.com.

Re: javax.jcr.PathNotFoundException for node with character '|' in name

Posted by hsp <pi...@ibest.com.br>.
Tobias,

In 
...core...SessionItemOperation
 /**
     * Performs this operation on the specified item. This method resolves
     * the given absolute path and calls the abstract
     * {@link #perform(ItemManager, Path)} method to actually perform the
     * selected operation.
     *
     * @throws RepositoryException if the operation fails
     */
    public T perform(SessionContext context) throws RepositoryException 
...
 Path normalized = context.getQPath(path).getNormalizedPath();
...

org.apache.jackrabbit.spi.commons.conversion.MalformedPathException: '/My
|ndex' is not a valid path. '|' not a valid name character.

Regards,

Helio.



--
View this message in context: http://jackrabbit.510166.n4.nabble.com/javax-jcr-PathNotFoundException-for-node-with-character-in-name-tp4660829p4660835.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.

Re: javax.jcr.PathNotFoundException for node with character '|' in name

Posted by Tobias Bocanegra <tr...@apache.org>.
So you're saying that:

session.nodeExists(parentNode.getNodes().nextNode().getPath());

returns false? (assuming your '|' node is the first node in the iteration)

regards, toby

On Fri, May 9, 2014 at 5:55 AM, hsp <pi...@ibest.com.br> wrote:
> Hi;
>
> There is a node in our repository, with name "My |ndex".
> I can't get this node by path, just raise the
> javax.jcr.PathNotFoundException.
> I have tried with Text.escapeIllegalJcrChars("My |ndex") without sucess
> (after escape it will be as "My %7ndex").
> Now, Is there a way to move (rename) such node, or at least delete it?
>
> Regards
> Helio.
>
>
>
> --
> View this message in context: http://jackrabbit.510166.n4.nabble.com/javax-jcr-PathNotFoundException-for-node-with-character-in-name-tp4660829.html
> Sent from the Jackrabbit - Users mailing list archive at Nabble.com.