mbien commented on code in PR #153:
URL: 
https://github.com/apache/netbeans-mavenutils-nbm-maven-plugin/pull/153#discussion_r1513131160


##########
nb-repository-plugin/src/main/java/org/apache/netbeans/nbm/repository/PopulateRepositoryMojo.java:
##########
@@ -1105,17 +1104,24 @@ else if ( wr instanceof ModuleWrapperMaven )
 //        mavenModel.setBuild(build);
 
         File fil = null;
-        try ( FileWriter writer = new FileWriter( fil ) )
+        try 
         {
-            MavenXpp3Writer xpp = new MavenXpp3Writer();
-            fil = Files.createTempFile( "maven", ".pom" ).toFile();
+            fil = Files.createTempFile("maven", ".pom").toFile();
             fil.deleteOnExit();
-            xpp.write( writer, mavenModel );
-        }
-        catch ( IOException ex )
+        } catch (IOException ex) 
         {
             ex.printStackTrace();
-        }        
+        }
+        if (fil != null) {

Review Comment:
   i have no problems at all with nesting, since it is very easy to get out of 
the situation once the method nests too deep: extract pieces to new methods.
   
   so nesting itself: no problem at all, if there is some periodic refactoring 
happening to keep methods simple.
   
   the try-with-resource block is essentially a scope block. It will find more 
usecases with structured concurrency etc so there will be a lot more of them 
soon.



-- 
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