if (realmName == null && index <= 0 ) {
System.err.println("A valid realm or the realm index need to be specified");
return null;
}
JaasRealm oldRealm = (JaasRealm) this.session.get(JAAS_REALM);
AppConfigurationEntry oldEntry = (AppConfigurationEntry) this.session.get(JAAS_ENTRY);
if (oldRealm != null && !oldRealm.getName().equals(realmName) && !force) {
System.err.println("Another realm is being edited. Cancel / update first, or use the --force option");
} else if (oldEntry != null && !oldEntry.getLoginModuleName().equals(moduleName) && !force) {
System.err.println("Another module is being edited. Cancel / update first, or use the --force option");
} else {
JaasRealm realm = findRealmByNameOrIndex(realmName, index);
if (realm != null) {
AppConfigurationEntry entry = findEntryByRealmAndName(realm, moduleName);
if (entry != null) {
Queue<JaasCommandSupport> commands = null;
commands = (Queue<JaasCommandSupport>) this.session.get(JAAS_CMDS);