You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by mi...@apache.org on 2021/09/24 12:05:21 UTC

[maven-invoker-plugin] 02/02: Auto-close exploited resource

This is an automated email from the ASF dual-hosted git repository.

michaelo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-invoker-plugin.git

commit e654521fff7e4f4715eca52912786e491fa73943
Author: Piotrek Żygieło <pz...@users.noreply.github.com>
AuthorDate: Fri Sep 24 11:19:30 2021 +0200

    Auto-close exploited resource
---
 src/main/java/org/apache/maven/plugins/invoker/InvokerSession.java | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/apache/maven/plugins/invoker/InvokerSession.java b/src/main/java/org/apache/maven/plugins/invoker/InvokerSession.java
index 511d8e5..12cf8c0 100644
--- a/src/main/java/org/apache/maven/plugins/invoker/InvokerSession.java
+++ b/src/main/java/org/apache/maven/plugins/invoker/InvokerSession.java
@@ -236,8 +236,10 @@ class InvokerSession
                     buildLogMessage.append( System.lineSeparator() );
                     buildLogMessage.append( "*** begin build.log for: " + buildJob.getProject() + " ***" );
                     buildLogMessage.append( System.lineSeparator() );
-                    FileReader buildLogReader = new FileReader( buildLogFile );
-                    buildLogMessage.append( IOUtil.toString( buildLogReader ) );
+                    try ( FileReader buildLogReader = new FileReader( buildLogFile ) )
+                    {
+                        buildLogMessage.append( IOUtil.toString( buildLogReader ) );
+                    }
                     buildLogMessage.append( "*** end build.log for: " + buildJob.getProject() + " ***" );
                     buildLogMessage.append( System.lineSeparator() );