From d427f36ad8df15873dfda7187141989a7fca40bb Mon Sep 17 00:00:00 2001 From: Harald Musum Date: Thu, 19 Sep 2024 17:54:22 +0200 Subject: [PATCH] Make sure to close stream --- .../model/application/provider/FilesApplicationPackage.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config-application-package/src/main/java/com/yahoo/config/model/application/provider/FilesApplicationPackage.java b/config-application-package/src/main/java/com/yahoo/config/model/application/provider/FilesApplicationPackage.java index 01fd0b7fe3ab..b6c091d6eaa5 100644 --- a/config-application-package/src/main/java/com/yahoo/config/model/application/provider/FilesApplicationPackage.java +++ b/config-application-package/src/main/java/com/yahoo/config/model/application/provider/FilesApplicationPackage.java @@ -653,7 +653,7 @@ private void validateServicesFile() throws IOException { } private long filesInApplicationPackage() { - return uncheck(() -> Files.list(appDir.toPath()).count()); + return uncheck(() -> { try (var files = Files.list(appDir.toPath())) { return files.count(); } }); } private void copyUserDefsIntoApplication() {