From 89659e7b213009acb3c3b8956e5cedce848a3883 Mon Sep 17 00:00:00 2001 From: Nuno Santos Date: Fri, 19 Dec 2025 14:11:33 +0100 Subject: [PATCH] Optimize PathUtils.concat for the case where parent is the root directory. --- .../java/org/apache/jackrabbit/oak/commons/PathUtils.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/PathUtils.java b/oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/PathUtils.java index d74bfd41e55..656cf34be19 100644 --- a/oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/PathUtils.java +++ b/oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/PathUtils.java @@ -317,8 +317,11 @@ public static String concat(String parentPath, String subPath) { } else if (isAbsolutePath(subPath)) { throw new IllegalArgumentException("Cannot append absolute path " + subPath); } - String separator = denotesRootPath(parentPath) ? "" : "/"; - return parentPath + separator + subPath; + if (denotesRootPath(parentPath)) { + return parentPath + subPath; + } else { + return parentPath + "/" + subPath; + } } /**