accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject svn commit: r1452502 - /accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/cli/ClientOpts.java
Date Mon, 04 Mar 2013 20:41:30 GMT
Author: ecn
Date: Mon Mar  4 20:41:29 2013
New Revision: 1452502

URL: http://svn.apache.org/r1452502
Log:
ACCUMULO-745 throw a meaning exception if the user runs a command that requires a user/passwd

Modified:
    accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/cli/ClientOpts.java

Modified: accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/cli/ClientOpts.java
URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/cli/ClientOpts.java?rev=1452502&r1=1452501&r2=1452502&view=diff
==============================================================================
--- accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/cli/ClientOpts.java
(original)
+++ accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/cli/ClientOpts.java
Mon Mar  4 20:41:29 2013
@@ -28,6 +28,7 @@ import org.apache.accumulo.core.client.A
 import org.apache.accumulo.core.client.Connector;
 import org.apache.accumulo.core.client.Instance;
 import org.apache.accumulo.core.client.ZooKeeperInstance;
+import org.apache.accumulo.core.client.impl.thrift.SecurityErrorCode;
 import org.apache.accumulo.core.client.mapreduce.AccumuloInputFormat;
 import org.apache.accumulo.core.client.mapreduce.AccumuloOutputFormat;
 import org.apache.accumulo.core.client.mock.MockInstance;
@@ -203,10 +204,12 @@ public class ClientOpts extends Help {
   }
   
   public Connector getConnector() throws AccumuloException, AccumuloSecurityException {
-    return getInstance().getConnector(this.principal, this.getToken());
+    return getInstance().getConnector(getCredentials());
   }
   
   public TCredentials getCredentials() throws AccumuloSecurityException {
+    if (this.principal == null || this.getToken() == null)
+      throw new AccumuloSecurityException("You must provide a user (-u) and password (-p)",
SecurityErrorCode.BAD_CREDENTIALS);
     return CredentialHelper.create(principal, getToken(), getInstance().getInstanceID());
   }
   



Mime
View raw message