This is an automated email from the ASF dual-hosted git repository. garydgregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-text.git
commit fd14824e0342e2bf23777e3da6a42bab1c8e0147 Author: Gary Gregory <[email protected]> AuthorDate: Mon Jun 1 12:28:58 2026 -0400 Internal refactoring --- src/main/java/org/apache/commons/text/lookup/PathFence.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/apache/commons/text/lookup/PathFence.java b/src/main/java/org/apache/commons/text/lookup/PathFence.java index 6c83082e..8f59a923 100644 --- a/src/main/java/org/apache/commons/text/lookup/PathFence.java +++ b/src/main/java/org/apache/commons/text/lookup/PathFence.java @@ -82,7 +82,7 @@ final class PathFence { * @param builder A builder. */ private PathFence(final Builder builder) { - this.roots = Arrays.stream(builder.roots).map(p -> p.toAbsolutePath().normalize()).collect(Collectors.toList()); + this.roots = Arrays.stream(builder.roots).map(this::normalize).collect(Collectors.toList()); } /** @@ -97,7 +97,7 @@ final class PathFence { if (roots.isEmpty()) { return path; } - final Path pathAbs = path.toAbsolutePath().normalize(); + final Path pathAbs = normalize(path); final Optional<Path> first = roots.stream().filter(pathAbs::startsWith).findFirst(); if (first.isPresent()) { return path; @@ -105,4 +105,8 @@ final class PathFence { throw new IllegalArgumentException(String.format("[%s] -> [%s] not in the fence %s", fileName, pathAbs, roots)); } + private Path normalize(final Path path) { + return path.toAbsolutePath().normalize(); + } + }
