accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject [1/3] git commit: ACCUMULO-2179 close the scanner
Date Mon, 13 Jan 2014 14:01:43 GMT
Updated Branches:
  refs/heads/1.6.0-SNAPSHOT 3ab5c3ee2 -> 0ab78c648


ACCUMULO-2179 close the scanner


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/1431d348
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/1431d348
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/1431d348

Branch: refs/heads/1.6.0-SNAPSHOT
Commit: 1431d3485ff0d54356d29e7b4ebee925ff254616
Parents: 826dc48
Author: Eric Newton <eric.newton@gmail.com>
Authored: Mon Jan 13 08:59:26 2014 -0500
Committer: Eric Newton <eric.newton@gmail.com>
Committed: Mon Jan 13 08:59:26 2014 -0500

----------------------------------------------------------------------
 .../core/util/shell/commands/CreateTableCommand.java | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/1431d348/src/core/src/main/java/org/apache/accumulo/core/util/shell/commands/CreateTableCommand.java
----------------------------------------------------------------------
diff --git a/src/core/src/main/java/org/apache/accumulo/core/util/shell/commands/CreateTableCommand.java
b/src/core/src/main/java/org/apache/accumulo/core/util/shell/commands/CreateTableCommand.java
index 1f69f4d..ac6f68c 100644
--- a/src/core/src/main/java/org/apache/accumulo/core/util/shell/commands/CreateTableCommand.java
+++ b/src/core/src/main/java/org/apache/accumulo/core/util/shell/commands/CreateTableCommand.java
@@ -22,6 +22,7 @@ import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map.Entry;
+import java.util.Scanner;
 import java.util.SortedSet;
 import java.util.TreeSet;
 
@@ -107,11 +108,15 @@ public class CreateTableCommand extends Command {
       String f = cl.getOptionValue(createTableOptSplit.getOpt());
       
       String line;
-      java.util.Scanner file = new java.util.Scanner(new File(f));
-      while (file.hasNextLine()) {
-        line = file.nextLine();
-        if (!line.isEmpty())
-          partitions.add(decode ? new Text(Base64.decodeBase64(line.getBytes())) : new Text(line));
+      Scanner file = new Scanner(new File(f));
+      try {
+        while (file.hasNextLine()) {
+          line = file.nextLine();
+          if (!line.isEmpty())
+            partitions.add(decode ? new Text(Base64.decodeBase64(line.getBytes())) : new
Text(line));
+        }
+      } finally {
+        file.close();
       }
     } else if (cl.hasOption(createTableOptCopySplits.getOpt())) {
       String oldTable = cl.getOptionValue(createTableOptCopySplits.getOpt());


Mime
View raw message