[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=17757379#comment-17757379 ] Julian Reschke commented on OAK-10304: -- trunk: (1.54.0) [601352d820|https://github.com/apache/jackrabbit-oak/commit/601352d820d320c040c9ce16c818f26f447a6840] 1.22: [232ac784ff|https://github.com/apache/jackrabbit-oak/commit/232ac784fff5f54e37283345a0d93340fed1c256] > 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 >Reporter: Julian Reschke >Assignee: Julian Reschke >Priority: Major > Fix For: 1.54.0, 1.22.17 > > > 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)
[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=17757307#comment-17757307 ] Julian Reschke commented on OAK-10304: -- Ok. Will do. > 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 >Reporter: Julian Reschke >Assignee: Julian Reschke >Priority: Major > Labels: candidate_oak_1_22 > 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)
[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=17757305#comment-17757305 ] Marcel Reutegger commented on OAK-10304: I would rather keep it simple and backport the code as is. If the log message is too noisy for some users, they can disable the logger by configuration. > 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 >Reporter: Julian Reschke >Assignee: Julian Reschke >Priority: Major > Labels: candidate_oak_1_22 > 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)
[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=17757235#comment-17757235 ] Julian Reschke commented on OAK-10304: -- We may want to backport this to 1.22, but maybe with a less severe warning level for now. Feedback appreciated. > 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 >Reporter: Julian Reschke >Assignee: Julian Reschke >Priority: Major > Labels: candidate_oak_1_22 > 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)
[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=17736003#comment-17736003 ] Julian Reschke commented on OAK-10304: -- trunk: [601352d820|https://github.com/apache/jackrabbit-oak/commit/601352d820d320c040c9ce16c818f26f447a6840] > 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 >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)
[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=17735813#comment-17735813 ] Julian Reschke commented on OAK-10304: -- Correct. There would only be logging for invalid namespace names other than "internal" (in order to reduce noise). I also only log invalid namespace names that *will* break expanded name usage (which triggered this issue). We could also extend it to check for all other aspects (like ASCIIness, escaping of special characters, etc), but that would essentially require running a URI parser on it everytime a namespace is set. > 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 >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)
[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=17735770#comment-17735770 ] Angela Schreiber commented on OAK-10304: [~reschke] , if i read the PR correctly you omit logging an error for the internal namespace, right? that would be important as we would otherwise get errors in the log, we don't really want to see. > 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 >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)
[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=17735767#comment-17735767 ] Julian Reschke commented on OAK-10304: -- For now I added code that will always log the invalid namespace name upon repo init. If this becomes problematic, we could still suppress it based on the call stack. > 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 >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)
[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=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)