You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by hb...@apache.org on 2017/12/20 09:28:51 UTC

[maven-ant-plugin] 10/18: o Fixed file leak

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

hboutemy pushed a commit to annotated tag maven-ant-plugin-2.2
in repository https://gitbox.apache.org/repos/asf/maven-ant-plugin.git

commit d7be49ce96a087737cb7d7abb1fcd2d46fa66cc0
Author: Benjamin Bentmann <be...@apache.org>
AuthorDate: Mon Apr 13 13:12:32 2009 +0000

    o Fixed file leak
    
    git-svn-id: https://svn.apache.org/repos/asf/maven/plugins/trunk/maven-ant-plugin@764436 13f79535-47bb-0310-9956-ffa450edef68
---
 .../java/org/apache/maven/plugin/ant/AntBuildWriter.java     | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/apache/maven/plugin/ant/AntBuildWriter.java b/src/main/java/org/apache/maven/plugin/ant/AntBuildWriter.java
index 915761a..81a70a8 100644
--- a/src/main/java/org/apache/maven/plugin/ant/AntBuildWriter.java
+++ b/src/main/java/org/apache/maven/plugin/ant/AntBuildWriter.java
@@ -130,7 +130,6 @@ public class AntBuildWriter
             return;
         }
 
-        FileOutputStream os = new FileOutputStream( new File( project.getBasedir(), DEFAULT_MAVEN_PROPERTIES_FILENAME ) );
         Properties properties = new Properties();
 
         // ----------------------------------------------------------------------
@@ -222,7 +221,16 @@ public class AntBuildWriter
             }
         }
 
-        properties.store( os, "Generated by Maven Ant Plugin - DO NOT EDIT THIS FILE!" );
+        FileOutputStream os =
+            new FileOutputStream( new File( project.getBasedir(), DEFAULT_MAVEN_PROPERTIES_FILENAME ) );
+        try
+        {
+            properties.store( os, "Generated by Maven Ant Plugin - DO NOT EDIT THIS FILE!" );
+        }
+        finally
+        {
+            IOUtil.close( os );
+        }
     }
 
     /**

-- 
To stop receiving notification emails like this one, please contact
"commits@maven.apache.org" <co...@maven.apache.org>.