continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r1375547 - /continuum/trunk/continuum-core/src/main/java/org/apache/continuum/release/distributed/manager/DefaultDistributedReleaseManager.java
Date Tue, 21 Aug 2012 13:55:42 GMT
Author: brett
Date: Tue Aug 21 13:55:42 2012
New Revision: 1375547

URL: http://svn.apache.org/viewvc?rev=1375547&view=rev
Log:
make sure the prepared-releases.xml file gets closed even if an exception
occurs

Modified:
    continuum/trunk/continuum-core/src/main/java/org/apache/continuum/release/distributed/manager/DefaultDistributedReleaseManager.java

Modified: continuum/trunk/continuum-core/src/main/java/org/apache/continuum/release/distributed/manager/DefaultDistributedReleaseManager.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/main/java/org/apache/continuum/release/distributed/manager/DefaultDistributedReleaseManager.java?rev=1375547&r1=1375546&r2=1375547&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/main/java/org/apache/continuum/release/distributed/manager/DefaultDistributedReleaseManager.java
(original)
+++ continuum/trunk/continuum-core/src/main/java/org/apache/continuum/release/distributed/manager/DefaultDistributedReleaseManager.java
Tue Aug 21 13:55:42 2012
@@ -873,13 +873,13 @@ public class DefaultDistributedReleaseMa
         PreparedReleaseModel model = new PreparedReleaseModel();
         model.setPreparedReleases( preparedReleases );
 
+        FileWriter fileWriter = null;
         try
         {
             ContinuumPrepareReleasesModelStaxWriter writer = new ContinuumPrepareReleasesModelStaxWriter();
-            FileWriter fileWriter = new FileWriter( file );
+            fileWriter = new FileWriter( file );
             writer.write( fileWriter, model );
             fileWriter.flush();
-            fileWriter.close();
         }
         catch ( IOException e )
         {
@@ -889,6 +889,10 @@ public class DefaultDistributedReleaseMa
         {
             throw new ContinuumReleaseException( "Failed to write prepared releases in file",
e );
         }
+        finally
+        {
+            IOUtil.close( fileWriter );
+        }
     }
 
     // for unit test
@@ -897,4 +901,4 @@ public class DefaultDistributedReleaseMa
     {
         this.buildResultDao = buildResultDao;
     }
-}
\ No newline at end of file
+}



Mime
View raw message