thomasmueller commented on code in PR #1283:
URL: https://github.com/apache/jackrabbit-oak/pull/1283#discussion_r1464468447


##########
oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/session/SessionNamespaces.java:
##########
@@ -86,6 +88,11 @@ synchronized void setNamespacePrefix(String prefix, String 
uri)
 
         // add the new mapping
         local.put(prefix, uri);
+
+        // make sure the previously mapped URI has a prefix
+        if (previouslyMappedUri != null) {
+            getNamespacePrefix(previouslyMappedUri);

Review Comment:
   So this works because getNamespacePrefix will put put a new prefix in the 
local mapping, if not found.
   
   The behavior of getNamespacePrefix is not changed (always was like that). 
And I assume setNamespacePrefix was not called a lot. So I think this change 
has a low risk.



##########
oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/session/SessionNamespaces.java:
##########
@@ -86,6 +88,11 @@ synchronized void setNamespacePrefix(String prefix, String 
uri)
 
         // add the new mapping
         local.put(prefix, uri);
+
+        // make sure the previously mapped URI has a prefix

Review Comment:
   ```suggestion
           // make sure the previously mapped URI has a prefix
           // (getNamespacePrefix has the side effect of generating
           // a new prefix if none was found, and adding that to the local 
mapping)
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@jackrabbit.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to