From b2e479d15e98650cafbac77e294cb1a71094e4b5 Mon Sep 17 00:00:00 2001 From: Alexey Loubyansky Date: Tue, 12 Nov 2024 20:09:47 +0100 Subject: [PATCH] Avoid making an extra call to Files.exists(p) in PathTree.ofDirectoryOrArchive(p, filter) --- .../app-model/src/main/java/io/quarkus/paths/PathTree.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/paths/PathTree.java b/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/paths/PathTree.java index c0c40b85a6837..649a87c2eefcb 100644 --- a/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/paths/PathTree.java +++ b/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/paths/PathTree.java @@ -47,7 +47,8 @@ static PathTree ofDirectoryOrArchive(Path p, PathFilter filter) { try { final BasicFileAttributes fileAttributes = Files.readAttributes(p, BasicFileAttributes.class); return fileAttributes.isDirectory() ? new DirectoryPathTree(p, filter) - : ofArchive(p, filter); + // invoke ArchivePathTree.forPath directly instead of ofArchive() to avoid an extra Files.exists invocation + : ArchivePathTree.forPath(p, filter); } catch (IOException e) { throw new IllegalArgumentException(p + " does not exist", e); } @@ -76,7 +77,6 @@ static PathTree ofArchive(Path archive, PathFilter filter) { if (!Files.exists(archive)) { throw new IllegalArgumentException(archive + " does not exist"); } - return ArchivePathTree.forPath(archive, filter); }