You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by el...@apache.org on 2014/01/11 00:34:42 UTC

[04/12] git commit: ACCUMULO-2176 Ensure scanner is closed.

ACCUMULO-2176 Ensure scanner is closed.


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

Branch: refs/heads/1.5.1-SNAPSHOT
Commit: 826dc4880ca1ed916d073dc101fe39d12f5c2fdb
Parents: c0db9ca
Author: Josh Elser <el...@apache.org>
Authored: Fri Jan 10 18:20:41 2014 -0500
Committer: Josh Elser <el...@apache.org>
Committed: Fri Jan 10 18:20:41 2014 -0500

----------------------------------------------------------------------
 .../accumulo/core/util/shell/commands/ExecfileCommand.java   | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/826dc488/src/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ExecfileCommand.java
----------------------------------------------------------------------
diff --git a/src/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ExecfileCommand.java b/src/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ExecfileCommand.java
index c7bf74f..54b1f94 100644
--- a/src/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ExecfileCommand.java
+++ b/src/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ExecfileCommand.java
@@ -35,8 +35,12 @@ public class ExecfileCommand extends Command {
   @Override
   public int execute(String fullCommand, CommandLine cl, Shell shellState) throws Exception {
     java.util.Scanner scanner = new java.util.Scanner(new File(cl.getArgs()[0]));
-    while (scanner.hasNextLine())
-      shellState.execCommand(scanner.nextLine(), true, cl.hasOption(verboseOption.getOpt()));
+    try {
+      while (scanner.hasNextLine())
+        shellState.execCommand(scanner.nextLine(), true, cl.hasOption(verboseOption.getOpt()));
+    } finally {
+      scanner.close();
+    }
     return 0;
   }