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.