maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1340575 - /maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/CpdReport.java
Date Sat, 19 May 2012 21:58:00 GMT
Author: olamy
Date: Sat May 19 21:58:00 2012
New Revision: 1340575

URL: http://svn.apache.org/viewvc?rev=1340575&view=rev
Log:
[MPMD-146] An incomplete fix for the resource leak bugs in CpdReport.java
Submitted by Guangtai Liang.

Modified:
    maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/CpdReport.java

Modified: maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/CpdReport.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/CpdReport.java?rev=1340575&r1=1340574&r2=1340575&view=diff
==============================================================================
--- maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/CpdReport.java
(original)
+++ maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/CpdReport.java
Sat May 19 21:58:00 2012
@@ -212,12 +212,13 @@ public class CpdReport
         }
 
         String buffer = r.render( cpd.getMatches() );
+        FileOutputStream tStream = null;
         Writer writer = null;
         try
         {
             targetDirectory.mkdirs();
             File targetFile = new File( targetDirectory, "cpd." + format );
-            FileOutputStream tStream = new FileOutputStream( targetFile );
+            tStream = new FileOutputStream( targetFile );
             writer = new OutputStreamWriter( tStream, getOutputEncoding() );
             writer.write( buffer );
             writer.close();
@@ -233,6 +234,7 @@ public class CpdReport
         finally
         {
             IOUtil.close( writer );
+            IOUtil.close( tStream );
         }
     }
 



Mime
View raw message