]> git.argeo.org Git - cc0/argeo-build.git/blobdiff - src/org/argeo/build/Make.java
Close directory stream
[cc0/argeo-build.git] / src / org / argeo / build / Make.java
index a8341fb970458d278c4a834a4e33535366e5d345..67246d527d3d17920579a2ec106e9d08de388225 100644 (file)
@@ -513,11 +513,11 @@ public class Make {
 
                // Write module-info.class
                if (moduleInfoClass != null) {
-                       Path moduleInfoClassP = compiled.resolve("module-info.class");
+                       Path moduleInfoClassP = binP.resolve("module-info.class");
                        Files.createDirectories(moduleInfoClassP.getParent());
                        try (OutputStream out = Files.newOutputStream(moduleInfoClassP)) {
                                moduleInfoClass.write(out);
-                               logger.log(INFO, "Wrote " + moduleInfoClassP);
+//                             logger.log(INFO, "Wrote " + moduleInfoClassP);
                        } catch (Exception e) {
                                throw new RuntimeException("Cannot write module-info.class");
                        }
@@ -677,7 +677,7 @@ public class Make {
        Map<String, Path> listLegalFilesToInclude(Path bundleBase) throws IOException {
                Map<String, Path> toInclude = new HashMap<>();
                if (!noSdkLegal) {
-                       DirectoryStream<Path> sdkSrcLegal = Files.newDirectoryStream(sdkSrcBase, (p) -> {
+                       try (DirectoryStream<Path> sdkSrcLegal = Files.newDirectoryStream(sdkSrcBase, (p) -> {
                                String fileName = p.getFileName().toString();
                                return switch (fileName) {
                                case "NOTICE":
@@ -688,9 +688,10 @@ public class Make {
                                default:
                                        yield false;
                                };
-                       });
-                       for (Path p : sdkSrcLegal)
-                               toInclude.put(p.getFileName().toString(), p);
+                       });) {
+                               for (Path p : sdkSrcLegal)
+                                       toInclude.put(p.getFileName().toString(), p);
+                       }
                }
                for (Iterator<Map.Entry<String, Path>> entries = toInclude.entrySet().iterator(); entries.hasNext();) {
                        Map.Entry<String, Path> entry = entries.next();