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

Konrad Windszus edited comment on OAK-11487 at 2/14/25 7:42 PM:
----------------------------------------------------------------

Internally {{PathMapper.getOakPath(String path)}} is called which deliberately 
returns null if either prefix or URI is unknown. However according to JCR spec 
URI unknown should be accepted (only unknown prefix is an error condition).


was (Author: kwin):
Internally {{PathMapper.getOakPath(String path)}} is called which deliberately 
returns null if either prefix or URI is unknown. However according to JCR spec 
URI unknown should be accepted according to JCR spec.

> Node.addNode(ExpandedName) fails with RepositoryException for unregistered 
> namespace URIs
> -----------------------------------------------------------------------------------------
>
>                 Key: OAK-11487
>                 URL: https://issues.apache.org/jira/browse/OAK-11487
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>            Reporter: Konrad Windszus
>            Priority: Major
>
> According to 
> [https://developer.adobe.com/experience-manager/reference-materials/spec/jcr/2.0/3_Repository_Model.html#3.5.1%20Namespace%20Registry]
> {quote}there may be repository content with namespaces that are not included 
> in the registry
> {quote}
> However when creating a new node with 
> {code}
> Node.addNode("{http://foo.com}bar";)
> {code}
>  (an expanded name for which no prefix is registered, neither locally in the 
> session nor globally) the following exception is thrown:
> {code:java}
> javax.jcr.RepositoryException: cannot determine oak path for: 
> {http://foo.com}bar
>       at 
> org.apache.jackrabbit.oak.jcr.session.NodeImpl.addNode(NodeImpl.java:278)
>       at 
> org.apache.jackrabbit.oak.jcr.session.NodeImpl.addNode(NodeImpl.java:267)
>       ...
> Caused by: javax.jcr.PathNotFoundException: {http://foo.com}bar
>       at 
> org.apache.jackrabbit.oak.jcr.session.SessionContext.getOakPathOrThrowNotFound(SessionContext.java:400)
>       at 
> org.apache.jackrabbit.oak.jcr.session.ItemImpl.getOakPathOrThrowNotFound(ItemImpl.java:333)
>       at 
> org.apache.jackrabbit.oak.jcr.session.NodeImpl.addNode(NodeImpl.java:276)
>       ... 23 more
> {code}
> .
> Also in 
> [https://developer.adobe.com/experience-manager/reference-materials/spec/jcr/2.0/3_Repository_Model.html#3.5.2%20Session-Local%20Mappings]
>  it is stated
> {quote}If a JCR method returns a name from the repository with a namespace 
> URI for which no local mapping exists, a prefix is created automatically and 
> a mapping between that prefix and the namespace URI in question is added to 
> the set of local mappings. The new prefix must differ from those already 
> present among the set of local mappings.
> {quote}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to