[jira] [Commented] (OAK-10304) Oak allows registration of invalid namespace names

2023-06-15 Thread Julian Reschke (Jira)


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

Julian Reschke commented on OAK-10304:
--

I'll go with just logging for now. We can always introduce the switch later on.

Logging gives us visibility for existing content. For that, it should by 
default be logged, right? I believe, WARN wouldn't be sufficient for that...

> Oak allows registration of invalid namespace names
> --
>
> Key: OAK-10304
> URL: https://issues.apache.org/jira/browse/OAK-10304
> Project: Jackrabbit Oak
>  Issue Type: Bug
>  Components: core, jcr
>Reporter: Julian Reschke
>Assignee: Julian Reschke
>Priority: Major
>
> 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) Oak allows registration of invalid namespace names

2023-06-15 Thread Angela Schreiber (Jira)


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

Angela Schreiber commented on OAK-10304:


[~reschke], i agree that fixing without backwards-compatibility option will 
likely cause issues. so, think we have a couple of options:

- document this as a known limitation/bug and resolve this ticket as won't fix, 
but log a message when an invalid namespace is registered
- fix the problem with an option to disable it for backwards compatibility, in 
which case i would also log a message (see before)

about the log level: i would log it as a warning.
apart from that i don't have a strong preference for either variant but i guess 
the first one is easier, no?

> Oak allows registration of invalid namespace names
> --
>
> Key: OAK-10304
> URL: https://issues.apache.org/jira/browse/OAK-10304
> Project: Jackrabbit Oak
>  Issue Type: Bug
>  Components: core, jcr
>Reporter: Julian Reschke
>Assignee: Julian Reschke
>Priority: Major
>
> 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) Oak allows registration of invalid namespace names

2023-06-15 Thread Marcel Reutegger (Jira)


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

Marcel Reutegger commented on OAK-10304:


bq. Fixing this may be hard due to legacy content.

Agreed.

+1 on documenting the current behaviour and log a message. Not sure about the 
log level though. WARN or ERROR.

> Oak allows registration of invalid namespace names
> --
>
> Key: OAK-10304
> URL: https://issues.apache.org/jira/browse/OAK-10304
> Project: Jackrabbit Oak
>  Issue Type: Bug
>  Components: core, jcr
>Reporter: Julian Reschke
>Assignee: Julian Reschke
>Priority: Major
>
> 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) Oak allows registration of invalid namespace names

2023-06-14 Thread Julian Reschke (Jira)


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

Julian Reschke commented on OAK-10304:
--

Fixing this may be hard due to legacy content.

If we can't (and that's what I assume), we should

- document it as JCR conformance issue, and
- maybe ERROR-log the call

[~mreutegg], [~angela] - feedback appreciated.

> Oak allows registration of invalid namespace names
> --
>
> Key: OAK-10304
> URL: https://issues.apache.org/jira/browse/OAK-10304
> Project: Jackrabbit Oak
>  Issue Type: Bug
>  Components: core, jcr
>Reporter: Julian Reschke
>Assignee: Julian Reschke
>Priority: Major
>
> 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}



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