geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jb...@apache.org
Subject svn commit: r749765 - /geronimo/server/trunk/plugins/console/plugin-portlets/src/main/java/org/apache/geronimo/console/securitymanager/realm/SecurityRealmPortlet.java
Date Tue, 03 Mar 2009 21:37:18 GMT
Author: jbohn
Date: Tue Mar  3 21:37:17 2009
New Revision: 749765

URL: http://svn.apache.org/viewvc?rev=749765&view=rev
Log:
merge 749758 from branches/2.1 - GERONIMO-4553 return an error in the admin console when an
error occurs creating a duplicate security realm

Modified:
    geronimo/server/trunk/plugins/console/plugin-portlets/src/main/java/org/apache/geronimo/console/securitymanager/realm/SecurityRealmPortlet.java

Modified: geronimo/server/trunk/plugins/console/plugin-portlets/src/main/java/org/apache/geronimo/console/securitymanager/realm/SecurityRealmPortlet.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/console/plugin-portlets/src/main/java/org/apache/geronimo/console/securitymanager/realm/SecurityRealmPortlet.java?rev=749765&r1=749764&r2=749765&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/console/plugin-portlets/src/main/java/org/apache/geronimo/console/securitymanager/realm/SecurityRealmPortlet.java
(original)
+++ geronimo/server/trunk/plugins/console/plugin-portlets/src/main/java/org/apache/geronimo/console/securitymanager/realm/SecurityRealmPortlet.java
Tue Mar  3 21:37:17 2009
@@ -208,8 +208,13 @@
             if (test == null || test.equals("true")) {
                 actionResponse.setRenderParameter(MODE_KEY, TEST_LOGIN_MODE);
             } else {
-                actionSaveRealm(actionRequest, data);
-                actionResponse.setRenderParameter(MODE_KEY, LIST_MODE);
+                final String error = actionSaveRealm(actionRequest, data);
+                if (error == null) {
+                    actionResponse.setRenderParameter(MODE_KEY, LIST_MODE);
+                } else {
+                    actionResponse.setRenderParameter("LoginModuleError", error);
+                    actionResponse.setRenderParameter(MODE_KEY, CONFIGURE_MODE);
+                }
             }
         } else if (mode.equals("process-" + TEST_LOGIN_MODE)) {
             actionAttemptLogin(data, actionRequest, actionRequest.getPortletSession(true),
actionRequest.getParameter("username"), actionRequest.getParameter("password"));
@@ -230,8 +235,13 @@
                 actionResponse.setRenderParameter(MODE_KEY, CONFIGURE_MODE);
             }
         } else if (mode.equals(SAVE_MODE)) {
-            actionSaveRealm(actionRequest, data);
-            actionResponse.setRenderParameter(MODE_KEY, LIST_MODE);
+            final String error = actionSaveRealm(actionRequest, data);
+            if (error == null) {
+                actionResponse.setRenderParameter(MODE_KEY, LIST_MODE);
+            } else {
+                actionResponse.setRenderParameter("LoginModuleError", error);
+                actionResponse.setRenderParameter(MODE_KEY, CONFIGURE_MODE);
+            }
         } else {
             actionResponse.setRenderParameter(MODE_KEY, mode);
         }
@@ -487,7 +497,7 @@
         data.modules = (LoginModuleDetails[]) list.toArray(new LoginModuleDetails[list.size()]);
     }
 
-    private void actionSaveRealm(PortletRequest request, RealmData data) {
+    private String actionSaveRealm(PortletRequest request, RealmData data) {
         normalize(data);
         if (data.getAbstractName() == null || data.getAbstractName().equals("")) { // we're
creating a new realm
             try {
@@ -516,9 +526,16 @@
                     if (po.getDeploymentStatus().isCompleted()) {
                         log.info("Deployment completed successfully!");
                     }
+                    else {
+                        return "Unable to save security realm ";
+                    }
+                }
+                else {
+                    return "Unable to save security realm ";
                 }
             } 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())));
@@ -544,6 +561,7 @@
                 module.setLoginModuleClass(details.getClassName());
             }
         }
+        return null;
     }
 
     private void renderList(RenderRequest request, RenderResponse response) throws IOException,
PortletException {



Mime
View raw message