Return-Path: X-Original-To: apmail-accumulo-commits-archive@www.apache.org Delivered-To: apmail-accumulo-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 0C147F22F for ; Thu, 18 Apr 2013 23:06:31 +0000 (UTC) Received: (qmail 70500 invoked by uid 500); 18 Apr 2013 23:06:31 -0000 Delivered-To: apmail-accumulo-commits-archive@accumulo.apache.org Received: (qmail 70475 invoked by uid 500); 18 Apr 2013 23:06:30 -0000 Mailing-List: contact commits-help@accumulo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@accumulo.apache.org Delivered-To: mailing list commits@accumulo.apache.org Received: (qmail 70467 invoked by uid 99); 18 Apr 2013 23:06:30 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 18 Apr 2013 23:06:30 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 18 Apr 2013 23:06:28 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id D7CF123889FA; Thu, 18 Apr 2013 23:06:07 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@accumulo.apache.org From: kturner@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20130418230607.D7CF123889FA@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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("");