accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From els...@apache.org
Subject [06/12] git commit: ACCUMULO-2176 Ensure scanner is closed.
Date Fri, 10 Jan 2014 23:34:44 GMT
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/master
Commit: 826dc4880ca1ed916d073dc101fe39d12f5c2fdb
Parents: c0db9ca
Author: Josh Elser <elserj@apache.org>
Authored: Fri Jan 10 18:20:41 2014 -0500
Committer: Josh Elser <elserj@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;
   }
   


Mime
View raw message