You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by re...@apache.org on 2024/01/23 15:52:14 UTC

(jackrabbit-oak) branch OAK-10544b created (now f922684490)

This is an automated email from the ASF dual-hosted git repository.

reschke pushed a change to branch OAK-10544b
in repository https://gitbox.apache.org/repos/asf/jackrabbit-oak.git


      at f922684490 OAK-10544: oak-jcr: remapping a namespace prefix leaves namespace resolver in broken state

This branch includes the following new commits:

     new f922684490 OAK-10544: oak-jcr: remapping a namespace prefix leaves namespace resolver in broken state

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(jackrabbit-oak) 01/01: OAK-10544: oak-jcr: remapping a namespace prefix leaves namespace resolver in broken state

Posted by re...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

reschke pushed a commit to branch OAK-10544b
in repository https://gitbox.apache.org/repos/asf/jackrabbit-oak.git

commit f9226844905a381505fddd6edd9c7684db2f12a7
Author: Julian Reschke <re...@apache.org>
AuthorDate: Tue Jan 23 16:51:57 2024 +0100

    OAK-10544: oak-jcr: remapping a namespace prefix leaves namespace resolver in broken state
---
 .../org/apache/jackrabbit/oak/jcr/session/SessionNamespaces.java   | 7 +++++++
 .../src/test/java/org/apache/jackrabbit/oak/jcr/NamePathTest.java  | 1 -
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/session/SessionNamespaces.java b/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/session/SessionNamespaces.java
index 8a217e2cc8..d64d600cbf 100644
--- a/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/session/SessionNamespaces.java
+++ b/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/session/SessionNamespaces.java
@@ -72,6 +72,8 @@ public class SessionNamespaces extends LocalNameMapper {
                     "Prefix is not a valid XML NCName: " + prefix);
         }
 
+        String previouslyMappedUri = getOakURIOrNull(prefix);
+
         // remove the possible existing mapping for the given prefix
         local.remove(prefix);
 
@@ -86,6 +88,11 @@ public class SessionNamespaces extends LocalNameMapper {
 
         // add the new mapping
         local.put(prefix, uri);
+
+        // make sure the previously mapped URI has a prefix
+        if (previouslyMappedUri != null) {
+            getNamespacePrefix(previouslyMappedUri);
+        }
     }
 
     /**
diff --git a/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/NamePathTest.java b/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/NamePathTest.java
index 556a41f7ad..6224f87d43 100644
--- a/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/NamePathTest.java
+++ b/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/NamePathTest.java
@@ -220,7 +220,6 @@ public class NamePathTest {
     }
 
     @Test
-    @Ignore("OAK-10544")
     public void testPrefixRemapping() throws NamespaceException, RepositoryException {
         Random r = new Random();
         int i1 = r.nextInt();