From cfd4507292db553a05380296dd7ead23fdfa5e7e Mon Sep 17 00:00:00 2001 From: Lakshya Malik Date: Mon, 8 Jun 2026 21:47:25 -0700 Subject: [PATCH] fix: close Files.walk stream in GitVersionControlLocalFileStorage.deleteRepo --- .../dataset/GitVersionControlLocalFileStorage.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/common/workflow-core/src/main/scala/org/apache/texera/amber/core/storage/util/dataset/GitVersionControlLocalFileStorage.java b/common/workflow-core/src/main/scala/org/apache/texera/amber/core/storage/util/dataset/GitVersionControlLocalFileStorage.java index 72566dd2d70..9efbffe8d4e 100644 --- a/common/workflow-core/src/main/scala/org/apache/texera/amber/core/storage/util/dataset/GitVersionControlLocalFileStorage.java +++ b/common/workflow-core/src/main/scala/org/apache/texera/amber/core/storage/util/dataset/GitVersionControlLocalFileStorage.java @@ -78,11 +78,13 @@ public static void removeFileFromRepo(Path repoPath, Path filePath) throws IOExc * @throws IOException If an I/O error occurs. */ public static void deleteRepo(Path directoryPath) throws IOException { - Files.walk(directoryPath) - .sorted(Comparator.reverseOrder()) - .map(Path::toFile) - .forEach(File::delete); - } + try (var stream = Files.walk(directoryPath)) { + stream + .sorted(Comparator.reverseOrder()) + .map(Path::toFile) + .forEach(File::delete); + } +} /** * Initializes a new repository for version control at the specified path.