accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ktur...@apache.org
Subject svn commit: r1469629 - /accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/Shell.java
Date Thu, 18 Apr 2013 23:06:07 GMT
Author: kturner
Date: Thu Apr 18 23:06:07 2013
New Revision: 1469629

URL: http://svn.apache.org/r1469629
Log:
ACCUMULO-1323 fixed prompting for password in shell and added some option checks for user,
password, and token options.

Modified:
    accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/Shell.java

Modified: accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/Shell.java
URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/Shell.java?rev=1469629&r1=1469628&r2=1469629&view=diff
==============================================================================
--- accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/Shell.java
(original)
+++ accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/Shell.java
Thu Apr 18 23:06:07 2013
@@ -256,6 +256,18 @@ public class Shell extends ShellOptions 
     
     // process default parameters if unspecified
     try {
+      if (loginOptions != null && !cl.hasOption(tokenOption.getOpt()))
+        throw new IllegalArgumentException("Must supply '-" + tokenOption.getOpt() + "' option
with '-" + loginOption.getOpt() + "' option");
+      
+      if (loginOptions == null && cl.hasOption(tokenOption.getOpt()))
+        throw new IllegalArgumentException("Must supply '-" + loginOption.getOpt() + "' option
with '-" + tokenOption.getOpt() + "' option");
+
+      if (passw != null && cl.hasOption(tokenOption.getOpt()))
+        throw new IllegalArgumentException("Can not supply '-" + passwOption.getOpt() + "'
option with '-" + tokenOption.getOpt() + "' option");
+
+      if (user == null)
+        throw new MissingArgumentException(usernameOption);
+
       if (loginOptions != null && cl.hasOption(tokenOption.getOpt())) {
         Properties props = new Properties();
         for (String loginOption : loginOptions)
@@ -285,9 +297,14 @@ public class Shell extends ShellOptions 
       }
       
       if (this.token == null) {
+        passw = readMaskedLine("Password: ", '*');
+        if (passw != null)
+          this.token = new PasswordToken(passw);
+      }
+      
+      if (this.token == null) {
         reader.printNewline();
-        configError = true;
-        return true;
+        throw new MissingArgumentException("No password or token option supplied");
       } // user canceled
       
       this.setTableName("");



Mime
View raw message