mbien commented on code in PR #4194:
URL: https://github.com/apache/netbeans/pull/4194#discussion_r899311333


##########
nbbuild/antsrc/org/netbeans/nbbuild/extlibs/MavenSkeletonProject.java:
##########
@@ -66,13 +67,15 @@ void execute() throws BuildException {
                 modules.add("nbbuild");
             } else {
                 Path nbAllPath = nball.toPath();
-                modules = new TreeSet<>(
-                        Files.walk(nbAllPath)
-                                .filter(p -> 
Files.exists(p.resolve("external/binaries-list")))
-                                .map(p -> nbAllPath.relativize(p))
-                                .map(p -> p.toString())
-                                .collect(Collectors.toSet())
-                );
+                modules = new TreeSet<>();
+                try ( Stream<Path> walk = Files.walk(nbAllPath)) {
+                    modules = new TreeSet<>(

Review Comment:
   the 2x new TreeSet() is because you don't want it to be null on exception? 
Wouldn't it be easier to initialize the private field as empty set so that you 
don't have to do this here twice?



##########
nbbuild/antsrc/org/netbeans/nbbuild/extlibs/VerifyLibsAndLicenses.java:
##########
@@ -426,11 +429,13 @@ private void testLicenses() throws IOException {
 
     private void testLicenseinfo() throws IOException {
         Path nballPath = nball.toPath();
-        List<File> licenseinfofiles = Files.walk(nballPath)
-                .filter(p -> p.endsWith("licenseinfo.xml"))
-                .map(p -> p.toFile())
-                .collect(Collectors.toList());
-
+        List<File> licenseinfofiles = new ArrayList<>();
+        try ( Stream<Path> walk = Files.walk(nballPath)) {
+            licenseinfofiles = walk

Review Comment:
   and here



##########
nbbuild/antsrc/org/netbeans/nbbuild/extlibs/VerifyLibsAndLicenses.java:
##########
@@ -94,13 +95,15 @@ public void setHaltonfailure(boolean haltonfailure) {
             modules.add("nbbuild");
         } else {
             Path nbAllPath = nball.toPath();
-            modules = new TreeSet<>(
-                    Files.walk(nbAllPath)
-                            .filter(p -> 
Files.exists(p.resolve("external/binaries-list")))
-                            .map(p -> nbAllPath.relativize(p))
-                            .map(p -> p.toString())
-                            .collect(Collectors.toSet())
-            );
+            modules = new TreeSet<>();
+                try ( Stream<Path> walk = Files.walk(nbAllPath)) {
+                    modules = new TreeSet<>(

Review Comment:
   same here



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to