From 15075631e94653890b374d675014e8dcc2ef88ff Mon Sep 17 00:00:00 2001 From: Andrea Cavalli Date: Tue, 19 Jul 2022 02:59:14 +0200 Subject: [PATCH] Bugfix --- .../it/cavallium/data/generator/SourcesGenerator.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/it/cavallium/data/generator/SourcesGenerator.java b/src/main/java/it/cavallium/data/generator/SourcesGenerator.java index 93b30ad..5fd1913 100644 --- a/src/main/java/it/cavallium/data/generator/SourcesGenerator.java +++ b/src/main/java/it/cavallium/data/generator/SourcesGenerator.java @@ -124,10 +124,10 @@ public class SourcesGenerator { } // Get the files list - var generatedFilesToDelete = Files - .find(outPath, Integer.MAX_VALUE, (filePath, fileAttr) -> fileAttr.isRegularFile()) - .map(outPath::relativize) - .collect(Collectors.toCollection(HashSet::new)); + HashSet generatedFilesToDelete; + try (var stream = Files.find(outPath, Integer.MAX_VALUE, (filePath, fileAttr) -> fileAttr.isRegularFile())) { + generatedFilesToDelete = stream.map(outPath::relativize).collect(Collectors.toCollection(HashSet::new)); + } // Update the hash Files.writeString(hashPath, basePackageName + '\n' + useRecordBuilders + '\n' + curHash + '\n',