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 2023/06/20 17:57:00 UTC
[jira] [Commented] (OAK-10304) log registration of invalid namespace names
[ https://issues.apache.org/jira/browse/OAK-10304?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17735402#comment-17735402 ]
Julian Reschke commented on OAK-10304:
--------------------------------------
I've done some experimentation.
One issue is that regular registration of namespaces upon repo startup goes through the same calls; so it's not trivial to distinguish between *initial* registration of an invalid namespace (that we would want to log), or regular startup of a repo that already has one.
These calls go through jcr-commons (CND reader), and that uses the javax.jcr interface, so extending the API to distinguish the cases is not an option.
We *could* check for invalid namespace names, and only then inspect the call stack. It's a bit hacky, but might work.
Thoughts?
cc [~mreutegg] and [~angela]?
> log registration of invalid namespace names
> -------------------------------------------
>
> Key: OAK-10304
> URL: https://issues.apache.org/jira/browse/OAK-10304
> Project: Jackrabbit Oak
> Issue Type: Task
> Components: core, jcr
> Reporter: Julian Reschke
> Assignee: Julian Reschke
> Priority: Major
> Fix For: 1.54.0
>
>
> Example:
> {noformat}
> diff --git a/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/RepositoryTest.java b/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/RepositoryTest.java
> index f113e4e0d2..7178a36f7f 100644
> --- a/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/RepositoryTest.java
> +++ b/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/RepositoryTest.java
> @@ -1996,6 +1996,24 @@ public class RepositoryTest extends AbstractRepositoryTest {
> assertFalse(asList(nsReg.getURIs()).contains("file:///foo"));
> }
> + @Test
> + public void testNamespaceNames() throws RepositoryException {
> + NamespaceRegistry nsReg =
> + getAdminSession().getWorkspace().getNamespaceRegistry();
> +
> + // valid
> + nsReg.registerNamespace("foo", "https://example.com");
> + nsReg.unregisterNamespace("foo");
> +
> + // invalid
> + try {
> + nsReg.registerNamespace("foo", "example.com");
> + fail("should not register invalid namespace name");
> + } finally {
> + nsReg.unregisterNamespace("foo");
> + }
> + }
> {noformat}
> Note that name of nodes using invalid namespaces do have a valid "expanded form" variant (https://developer.adobe.com/experience-manager/reference-materials/spec/jcr/2.0/3_Repository_Model.html#3.2.5.1%20Expanded%20Form).
--
This message was sent by Atlassian Jira
(v8.20.10#820010)