} catch (IOException e) {
log.error("Unable to save security realm", e);
return "Unable to save security realm: " + e.getMessage();
}
} else {
SecurityRealm realm = (SecurityRealm) PortletManager.getManagedBean(request, new AbstractName(URI.create(data.getAbstractName())));
// index existing modules
Map nodes = new HashMap();
JaasLoginModuleChain node = realm.getLoginModuleChain();
while (node != null) {
LoginModuleSettings module = node.getLoginModule();
nodes.put(module.getLoginDomainName(), node);
node = node.getNext();
if (node == null) {