maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From denn...@apache.org
Subject svn commit: r1579079 - /maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/ChangesXML.java
Date Tue, 18 Mar 2014 22:57:22 GMT
Author: dennisl
Date: Tue Mar 18 22:57:22 2014
New Revision: 1579079

URL: http://svn.apache.org/r1579079
Log:
Fix problem reported by FindBugs: may fail to clean up java.io.InputStream

Modified:
    maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/ChangesXML.java

Modified: maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/ChangesXML.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/ChangesXML.java?rev=1579079&r1=1579078&r2=1579079&view=diff
==============================================================================
--- maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/ChangesXML.java
(original)
+++ maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/ChangesXML.java
Tue Mar 18 22:57:22 2014
@@ -29,6 +29,7 @@ import org.apache.maven.plugins.changes.
 import org.apache.maven.plugins.changes.model.ChangesDocument;
 import org.apache.maven.plugins.changes.model.Properties;
 import org.apache.maven.plugins.changes.model.io.xpp3.ChangesXpp3Reader;
+import org.codehaus.plexus.util.IOUtil;
 
 /**
  * A facade for a changes.xml file.
@@ -57,12 +58,15 @@ public class ChangesXML
             return;
         }
 
+        FileInputStream fileInputStream = null;
+
         try
         {
 
             ChangesXpp3Reader reader = new ChangesXpp3Reader();
 
-            changesDocument = reader.read( new FileInputStream( xmlPath ), false );
+            fileInputStream = new FileInputStream( xmlPath );
+            changesDocument = reader.read( fileInputStream, false );
 
             if ( changesDocument == null )
             {
@@ -97,6 +101,10 @@ public class ChangesXML
             // FIXME throw an Exception ?
             log.error( "An error occurred when parsing the changes.xml file: ", e );
         }
+        finally
+        {
+            IOUtil.close( fileInputStream );
+        }
     }
 
     public void setAuthor( String author )



Mime
View raw message