*/
private void doAdminPasswordCheck() throws CommandException {
String arfile = launcher.getAdminRealmKeyFile();
if (arfile != null) {
try {
FileRealmHelper ar = new FileRealmHelper(arfile);
if (!ar.hasAuthenticatableUser()) {
// Prompt for the password for the first user and set it
Set<String> names = ar.getUserNames();
if (names == null || names.isEmpty()) {
throw new CommandException("no admin users");
}
String auser = names.iterator().next();
ParamModelData npwo = new ParamModelData(newpwName, String.class, false, null);
npwo.prompt = strings.get("new.adminpw", auser);
npwo.promptAgain = strings.get("new.adminpw.again", auser);
npwo.param._password = true;
logger.info(strings.get("new.adminpw.prompt"));
String npw = super.getPassword(npwo, null, true);
if (npw == null) {
throw new CommandException(strings.get("no.console"));
}
ar.updateUser(auser, auser, npw.toCharArray(), null);
ar.persist();
}
} catch (IOException ioe) {
throw new CommandException(ioe);
}
}