cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dbros...@apache.org
Subject [3/5] git commit: make sure files get closed
Date Mon, 21 Oct 2013 01:59:40 GMT
make sure files get closed


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

Branch: refs/heads/trunk
Commit: 9afac241090ee961bd1bcd3c9e78798ac1868d37
Parents: abe1395
Author: Dave Brosius <dbrosius@mebigfatguy.com>
Authored: Sun Oct 20 21:52:08 2013 -0400
Committer: Dave Brosius <dbrosius@mebigfatguy.com>
Committed: Sun Oct 20 21:52:08 2013 -0400

----------------------------------------------------------------------
 src/java/org/apache/cassandra/cli/CliMain.java | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/9afac241/src/java/org/apache/cassandra/cli/CliMain.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cli/CliMain.java b/src/java/org/apache/cassandra/cli/CliMain.java
index 8c110c2..39a10db 100644
--- a/src/java/org/apache/cassandra/cli/CliMain.java
+++ b/src/java/org/apache/cassandra/cli/CliMain.java
@@ -264,18 +264,22 @@ public class CliMain
         // load statements from file and process them
         if (sessionState.inFileMode())
         {
-            FileReader fileReader;
+            BufferedReader reader = null;
 
             try
             {
-                fileReader = new FileReader(sessionState.filename);
-                evaluateFileStatements(new BufferedReader(fileReader));
+                reader = new BufferedReader(new FileReader(sessionState.filename));
+                evaluateFileStatements(reader);
             }
             catch (IOException e)
             {
                 sessionState.err.println(e.getMessage());
                 System.exit(1);
             }
+            finally
+            {
+                FileUtils.closeQuietly(reader);
+            }      
 
             return;
         }


Mime
View raw message