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 "Julian Reschke (Jira)" <ji...@apache.org> on 2022/12/04 18:05:00 UTC

[jira] [Comment Edited] (OAK-9956) javax.jcr.Node.addNode(...) throws javax.jcr.PathNotFoundException for any unmapped namespaces in expanded path notation

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

Julian Reschke edited comment on OAK-9956 at 12/4/22 6:04 PM:
--------------------------------------------------------------

{quote}IMHO not, according to JCR spec it should be supported to use unmapped namespaces (both with nodes and properties).
{quote}
Agreed in principle.

Pragmatically, I'd like to fix at lest the exception so it's not misleading anymore. "addNode()" does not allow a NamespaceException here - because, yes, the repo should actually accept the relative name.

So for now I would use a RepositoryException, just like in Jackrabbit classic.

cc [~mreutegg] , [~angela] 

 


was (Author: reschke):
{quote}IMHO not, according to JCR spec it should be supported to use unmapped namespaces (both with nodes and properties).
{quote}
Agreed in principle.

Pragmatically, I'd like to fix at lest the exception so it's not misleading anymore.

 

> javax.jcr.Node.addNode(...) throws javax.jcr.PathNotFoundException for any unmapped namespaces in expanded path notation
> ------------------------------------------------------------------------------------------------------------------------
>
>                 Key: OAK-9956
>                 URL: https://issues.apache.org/jira/browse/OAK-9956
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>    Affects Versions: 1.44.0
>            Reporter: Konrad Windszus
>            Assignee: Julian Reschke
>            Priority: Major
>
> In case {{Node.addNode(...)}} is called with a path in [expanded form|https://developer.adobe.com/experience-manager/reference-materials/spec/jcr/2.0/3_Repository_Model.html#3.2.5.1%20Expanded%20Form] containing a namespace URI which is not mapped a {{javax.jcr.PathNotFoundException}} is thrown. This is unexpected as the JCR 2.0 spec allows unmapped namespaces according to https://developer.adobe.com/experience-manager/reference-materials/spec/jcr/2.0/3_Repository_Model.html#3.5.2%20Session-Local%20Mappings and https://developer.adobe.com/experience-manager/reference-materials/spec/jcr/2.0/3_Repository_Model.html#3.4.3.4%20Parsing%20Lexical%20Paths
> {quote}When parsing a lexical path, the parser must distinguish between name segments that are in expanded form and those that are in qualified form (see §3.2.5 Lexical Form of JCR Names). When making this determination, the repository cannot assume that every namespace URI encountered in an expanded name will be registered within the repository.
> An otherwise valid path containing an expanded name with an unregistered namespace URI will always resolve into a valid internal representation of a path (i.e., an ordered list of path segments, see §3.4 Paths). Any errors that arise from passing such a path must therefore be as a result of further processing (not merely parsing) that depends on the semantics of the path and the context of use.{quote}
> The same exception is thrown if there is a prefix only locally registered via {{Session.setNamespacePrefix(....)}} for both cases when calling {{addNode(...)}} afterwards in either qualified or expanded form.



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