Pankraz76 commented on code in PR #2443:
URL: https://github.com/apache/maven/pull/2443#discussion_r2133686057


##########
its/core-it-support/core-it-plugins/maven-it-plugin-active-collection/src/main/java/org/apache/maven/plugin/coreit/CheckThreadSafetyMojo.java:
##########
@@ -133,21 +133,11 @@ public void run() {
 
         getLog().info("[MAVEN-CORE-IT-LOG] Creating output file " + 
outputFile);
 
-        OutputStream out = null;
-        try {
-            outputFile.getParentFile().mkdirs();
-            out = new FileOutputStream(outputFile);
+        outputFile.getParentFile().mkdirs();
+        try (OutputStream out = new FileOutputStream(outputFile)) {
             componentProperties.store(out, "MAVEN-CORE-IT-LOG");
         } catch (IOException e) {
-            throw new MojoExecutionException("Output file could not be 
created: " + outputFile, e);
-        } finally {
-            if (out != null) {
-                try {
-                    out.close();
-                } catch (IOException e) {
-                    // just ignore
-                }
-            }
+            throw new MojoExecutionException(e);

Review Comment:
   you mean the absent catch `} catch (IOException e) {` in `L:147`?
   This is treaded just the same as before, by the `autocloseable` feature. 
   
   Only change is that we now skip the custom message `"Output file could not 
be created: " + outputFile`, as considered fluff.
   Everything else should remain the same, just without all the boilerplate,



-- 
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: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to