kwin commented on code in PR #2229:
URL: https://github.com/apache/jackrabbit-oak/pull/2229#discussion_r2062661672
##########
oak-core/src/main/java/org/apache/jackrabbit/oak/namepath/impl/GlobalNameMapper.java:
##########
@@ -143,17 +146,23 @@ public String getExpandedJcrName(@NotNull String oakName)
{
int colon = oakName.indexOf(':');
if (colon > 0) {
String oakPrefix = oakName.substring(0, colon);
- // local mapping must take precedence...
- uri = getSessionLocalMappings().get(oakPrefix);
+ uri = getNamespacesProperty(oakPrefix);
+ // global mapping must take precedence...
if (uri == null) {
- // ...over global mappings
- uri = getNamespacesProperty(oakPrefix);
+ // ...over local mappings
+ uri = getSessionLocalMappings().get(oakPrefix);
}
if (uri == null) {
throw new IllegalStateException(
"No namespace mapping found for " + oakName);
}
localName = oakName.substring(colon + 1);
+ // check namespace name for validity in Oak
+ if (!isValidNamespaceName(uri)) {
+ throw new IllegalStateException(
+ new NamespaceException("Cannot determine expanded name for
'" + oakName +
Review Comment:
> Note that this case already is error-logged.
Have you found real use cases of that in life code? Otherwise I would tend
to at least optionally toggle the behaviour to throw in case of invalid URI
during namespace registration.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]