You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-issues@jackrabbit.apache.org by "Konrad Windszus (Jira)" <ji...@apache.org> on 2025/02/14 19:36:00 UTC

[jira] [Created] (OAK-11487) Node.addNode(ExpandedName) fails with RepositoryException for unregistered namespace URIs

Konrad Windszus created OAK-11487:
-------------------------------------

             Summary: 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


According to https://developer.adobe.com/experience-manager/reference-materials/spec/jcr/2.0/3_Repository_Model.html#3.5.1%20Namespace%20Registry

bq. there may be repository content with namespaces that are not included in the registry

However when creating a new node with {{Node.addNode("{http://foo.com}bar"}} (an expanded name for which no prefix is registered, neither locally in the session nor globally) the following exception is thrown:

{code}
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

bq. 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.




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