[ 
https://issues.apache.org/jira/browse/OAK-1624?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13949072#comment-13949072
 ] 

Michael Dürig commented on OAK-1624:
------------------------------------

This is yet another instance of OAK-1174: adding a session scoped namespace 
remapping changes the behaviour disallowing trailing spaces. I.e. with

{code}
        session.setNamespacePrefix("foo", "http://foo.bar";);
{code}

I get

{noformat}
java.lang.IllegalArgumentException: '/hello/test ' is not a valid path: 
Trailing slashes not allowed in prefixes and names.
        at 
org.apache.jackrabbit.oak.namepath.NamePathMapperImpl$1.error(NamePathMapperImpl.java:112)
        at 
org.apache.jackrabbit.oak.namepath.JcrPathParser.parse(JcrPathParser.java:104)
        at 
org.apache.jackrabbit.oak.namepath.NamePathMapperImpl.getJcrPath(NamePathMapperImpl.java:127)
        at 
org.apache.jackrabbit.oak.jcr.session.SessionContext.getJcrPath(SessionContext.java:317)
        at 
org.apache.jackrabbit.oak.jcr.session.ItemImpl.toJcrPath(ItemImpl.java:339)
        at 
org.apache.jackrabbit.oak.jcr.session.ItemImpl.getPath(ItemImpl.java:153)
        at 
org.apache.jackrabbit.oak.jcr.session.NodeImpl.getPath(NodeImpl.java:99)
{noformat}

This is most likely also caused by the (apparently still shaky) parsing 
heuristics in 
{{org.apache.jackrabbit.oak.namepath.NamePathMapperImpl#needsFullMapping}}


> Item names with trailing spaces should not be allowed
> -----------------------------------------------------
>
>                 Key: OAK-1624
>                 URL: https://issues.apache.org/jira/browse/OAK-1624
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>            Reporter: Tobias Bocanegra
>            Priority: Blocker
>             Fix For: 0.20
>
>
> the following should fail:
> {code}
>         Node hello = session.getRootNode().addNode("hello");
>         session.save();
>         Node illegal = hello.addNode("test "); <-- here
>         session.save();
>         assertEquals("/hello/test ", illegal.getPath()); <-- and here
>         Node other = session.getNode("/hello/test "); <-- and here
>         assertTrue(other.isSame(illegal));
>         assertTrue(session.nodeExists("/hello/test ")); <-- and here
> {code}



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to