}
public static class UserCommand extends Command {
public int execute(String fullCommand, CommandLine cl, Shell shellState) throws AccumuloException, AccumuloSecurityException, IOException {
// save old credentials and connection in case of failure
AuthInfo prevCreds = shellState.credentials;
Connector prevConn = shellState.connector;
boolean revertCreds = false;
String user = cl.getArgs()[0];
byte[] pass;
// We can't let the wrapping try around the execute method deal
// with the exceptions because we have to do something if one
// of these methods fails
try {
String p = shellState.reader.readLine("Enter password for user " + user + ": ", '*');
if (p == null) {
shellState.reader.printNewline();
return 0;
} // user canceled
pass = p.getBytes();
shellState.credentials = new AuthInfo(user, pass, shellState.connector.getInstance().getInstanceID());
shellState.connector = shellState.connector.getInstance().getConnector(user, pass);
} catch (AccumuloException e) {
revertCreds = true;
throw e;
} catch (AccumuloSecurityException e) {