You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Carsten Ziegeler (JIRA)" <ji...@apache.org> on 2014/02/17 16:54:19 UTC
[jira] [Commented] (SLING-2964) JcrResourceUtil.createPath() API
should handle paths ending with "/"
[ https://issues.apache.org/jira/browse/SLING-2964?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13903324#comment-13903324 ]
Carsten Ziegeler commented on SLING-2964:
-----------------------------------------
While I think the client should not pass in a path ending with slash, I agree that both cases should be handled in the same way.
As its already working if the node exists, enabling the create seems to be the compatible option to choose
> JcrResourceUtil.createPath() API should handle paths ending with "/"
> --------------------------------------------------------------------
>
> Key: SLING-2964
> URL: https://issues.apache.org/jira/browse/SLING-2964
> Project: Sling
> Issue Type: Improvement
> Components: JCR
> Affects Versions: JCR Resource 2.3.0
> Reporter: Amrit Verma
> Assignee: Carsten Ziegeler
> Priority: Minor
> Fix For: JCR Resource 2.3.2
>
> Attachments: sling_diff.txt
>
>
> Calling JcrResourceUtil.createPath(String path,
> String intermediateNodeType,
> String nodeType,
> Session session,
> boolean autoSave)
> with the parameter as "/a/b/c/" , throws following exception if the path doesn't exist:
> javax.jcr.RepositoryException: Failed to resolve path relative to node /a/b/c
> at org.apache.jackrabbit.core.NodeImpl.resolveRelativePath(NodeImpl.java:239)
> at org.apache.jackrabbit.core.NodeImpl.resolveRelativeNodePath(NodeImpl.java:222)
> at org.apache.jackrabbit.core.NodeImpl.hasNode(NodeImpl.java:2265)
> at org.apache.sling.jcr.resource.JcrResourceUtil.createPath(JcrResourceUtil.java:341)
> at org.apache.sling.jcr.resource.JcrResourceUtil.createPath(JcrResourceUtil.java:285)
> But if the path /a/b/c already exists and we still pass the path parameter as "/a/b/c/" the API returns the 'c' node.
--
This message was sent by Atlassian JIRA
(v6.1.5#6160)