From 96601ced50862c4a6908c52ad6c1de5f6998bb96 Mon Sep 17 00:00:00 2001 From: Romain Manni-Bucau Date: Tue, 30 Jan 2024 11:56:12 +0100 Subject: [PATCH] [debt] simplify bundlebee-directory-json-key-value-pairs code --- .../yupiik/bundlebee/core/lang/SubstitutorProducer.java | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/bundlebee-core/src/main/java/io/yupiik/bundlebee/core/lang/SubstitutorProducer.java b/bundlebee-core/src/main/java/io/yupiik/bundlebee/core/lang/SubstitutorProducer.java index f79b6993..703a3d05 100644 --- a/bundlebee-core/src/main/java/io/yupiik/bundlebee/core/lang/SubstitutorProducer.java +++ b/bundlebee-core/src/main/java/io/yupiik/bundlebee/core/lang/SubstitutorProducer.java @@ -198,14 +198,7 @@ protected String doSubstitute(final AtomicReference self, final Con try (final var dir = lastSep < 0 ? Files.newDirectoryStream(Path.of(directory)) : Files.newDirectoryStream(Path.of(directory.substring(0, lastSep)), directory.substring(lastSep + 1)); - final var stream = stream(Spliterators.spliteratorUnknownSize(dir.iterator(), Spliterator.DISTINCT), false) - .onClose(() -> { - try { - dir.close(); - } catch (final IOException ioe) { - throw new IllegalStateException(ioe); - } - })) { + final var stream = stream(Spliterators.spliteratorUnknownSize(dir.iterator(), Spliterator.DISTINCT), false)) { return stream .sorted(comparing(Path::getFileName)) .collect(Collector.of(