You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by db...@apache.org on 2014/11/13 04:54:35 UTC

cassandra git commit: make sure streams get closed

Repository: cassandra
Updated Branches:
  refs/heads/trunk 938248640 -> 7c93b04b3


make sure streams get closed


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/7c93b04b
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/7c93b04b
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/7c93b04b

Branch: refs/heads/trunk
Commit: 7c93b04b34844afdc3a502af9e7fb296f43dc068
Parents: 9382486
Author: Dave Brosius <db...@mebigfatguy.com>
Authored: Wed Nov 12 22:53:47 2014 -0500
Committer: Dave Brosius <db...@mebigfatguy.com>
Committed: Wed Nov 12 22:53:47 2014 -0500

----------------------------------------------------------------------
 src/java/org/apache/cassandra/db/ColumnFamilyStore.java | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/7c93b04b/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/ColumnFamilyStore.java b/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
index 9994038..07f7f53 100644
--- a/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
+++ b/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
@@ -2173,16 +2173,18 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean
     private void writeSnapshotManifest(final JSONArray filesJSONArr, final String snapshotName)
     {
         final File manifestFile = directories.getSnapshotManifestFile(snapshotName);
-        final JSONObject manifestJSON = new JSONObject();
-        manifestJSON.put("files", filesJSONArr);
 
         try
         {
             if (!manifestFile.getParentFile().exists())
                 manifestFile.getParentFile().mkdirs();
-            PrintStream out = new PrintStream(manifestFile);
-            out.println(manifestJSON.toJSONString());
-            out.close();
+            
+            try (PrintStream out = new PrintStream(manifestFile))
+            {
+                final JSONObject manifestJSON = new JSONObject();
+                manifestJSON.put("files", filesJSONArr);
+                out.println(manifestJSON.toJSONString());
+            }
         }
         catch (IOException e)
         {