src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LibProvidersLookup.java
branchJDK-8200758-branch
changeset 58670 6fb9e12d5595
parent 58417 67ffaf3a2b75
--- a/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LibProvidersLookup.java	Wed Oct 16 10:32:08 2019 -0400
+++ b/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LibProvidersLookup.java	Thu Oct 17 07:55:35 2019 -0400
@@ -52,9 +52,12 @@
 
     List<String> execute(Path root) throws IOException {
         // Get the list of files in the root for which to look up for needed shared libraries
-        List<Path> allPackageFiles = Files.walk(root).filter(
-                Files::isRegularFile).filter(LibProvidersLookup::canDependOnLibs).collect(
-                Collectors.toList());
+        List<Path> allPackageFiles;
+        try (Stream<Path> stream = Files.walk(root)) {
+            allPackageFiles = stream.filter(Files::isRegularFile).filter(
+                    LibProvidersLookup::canDependOnLibs).collect(
+                    Collectors.toList());
+        }
 
         Collection<Path> neededLibs = getNeededLibsForFiles(allPackageFiles);