continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From batkin...@apache.org
Subject svn commit: r1662274 - /continuum/trunk/continuum-core/src/main/java/org/apache/continuum/builder/distributed/DefaultDistributedBuildService.java
Date Wed, 25 Feb 2015 17:17:05 GMT
Author: batkinson
Date: Wed Feb 25 17:17:05 2015
New Revision: 1662274

URL: http://svn.apache.org/r1662274
Log:
Possible fd leak handling distributed build output.

Modified:
    continuum/trunk/continuum-core/src/main/java/org/apache/continuum/builder/distributed/DefaultDistributedBuildService.java

Modified: continuum/trunk/continuum-core/src/main/java/org/apache/continuum/builder/distributed/DefaultDistributedBuildService.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/main/java/org/apache/continuum/builder/distributed/DefaultDistributedBuildService.java?rev=1662274&r1=1662273&r2=1662274&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/main/java/org/apache/continuum/builder/distributed/DefaultDistributedBuildService.java
(original)
+++ continuum/trunk/continuum-core/src/main/java/org/apache/continuum/builder/distributed/DefaultDistributedBuildService.java
Wed Feb 25 17:17:05 2015
@@ -19,6 +19,7 @@ package org.apache.continuum.builder.dis
  * under the License.
  */
 
+import org.apache.commons.io.IOUtils;
 import org.apache.continuum.builder.distributed.manager.DistributedBuildManager;
 import org.apache.continuum.builder.distributed.util.DistributedBuildUtil;
 import org.apache.continuum.builder.utils.ContinuumBuildConstant;
@@ -164,13 +165,16 @@ public class DefaultDistributedBuildServ
             projectDao.updateProject( project );
 
             File buildOutputFile = configurationService.getBuildOutputFile( buildResult.getId(),
project.getId() );
-
-            FileWriter fstream = new FileWriter( buildOutputFile );
-            BufferedWriter out = new BufferedWriter( fstream );
-            out.write( ContinuumBuildConstant.getBuildOutput( context ) == null
-                           ? ""
-                           : ContinuumBuildConstant.getBuildOutput( context ) );
-            out.close();
+            FileWriter fileWriter = null;
+            try
+            {
+                fileWriter = new FileWriter( buildOutputFile );
+                String output = ContinuumBuildConstant.getBuildOutput( context );
+                fileWriter.write( output == null ? "" : output );
+            } finally
+            {
+                IOUtils.closeQuietly(fileWriter);
+            }
 
             if ( buildResult.getState() != ContinuumProjectState.CANCELLED )
             {



Mime
View raw message