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 JAAS 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 JAAS Login Module is being edited. Cancel/update first, or use the --force option.");
} else {
JaasRealm realm = null;
AppConfigurationEntry entry = null;
if (index > 0) {
// user provided the index, get the realm AND entry from the index
List<JaasRealm> realms = getRealms();
if (realms != null && realms.size() > 0) {