(prefix.isEmpty() ? "Gerrit Code Review" : prefix) + ": "
+ commandName + ": not found";
throw new UnloggedFailure(1, msg);
}
final Command cmd = p.get();
if (isAdminCommand(cmd) && !currentUser.get().isAdministrator()) {
final String msg = "fatal: Not a Gerrit administrator";
throw new UnloggedFailure(BaseCommand.STATUS_NOT_ADMIN, msg);
}
if (cmd instanceof BaseCommand) {
final BaseCommand bc = (BaseCommand) cmd;
if (prefix.isEmpty())
bc.setName(commandName);
else
bc.setName(prefix + " " + commandName);
bc.setArguments(args.toArray(new String[args.size()]));
} else if (!args.isEmpty()) {
throw new UnloggedFailure(1, commandName + " does not take arguments");
}
provideStateTo(cmd);
synchronized (this) {
this.cmd = cmd;
}
cmd.start(env);
} catch (UnloggedFailure e) {
String msg = e.getMessage();
if (!msg.endsWith("\n")) {
msg += "\n";