roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject svn commit: r917358 - in /roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/ui: core/RollerContext.java struts2/admin/ModifyUser.java
Date Mon, 01 Mar 2010 02:37:20 GMT
Author: snoopdave
Date: Mon Mar  1 02:37:20 2010
New Revision: 917358

URL: http://svn.apache.org/viewvc?rev=917358&view=rev
Log:
Fixes "Editing a user in the user administration page causes an exception"
https://issues.apache.org/jira/browse/ROL-1853

Modified:
    roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/ui/core/RollerContext.java
    roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/ui/struts2/admin/ModifyUser.java

Modified: roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/ui/core/RollerContext.java
URL: http://svn.apache.org/viewvc/roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/ui/core/RollerContext.java?rev=917358&r1=917357&r2=917358&view=diff
==============================================================================
--- roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/ui/core/RollerContext.java
(original)
+++ roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/ui/core/RollerContext.java
Mon Mar  1 02:37:20 2010
@@ -51,6 +51,7 @@
 import org.apache.roller.weblogger.ui.core.security.AutoProvision;
 import org.apache.roller.weblogger.util.cache.CacheManager;
 import org.apache.velocity.runtime.RuntimeSingleton;
+import org.springframework.beans.factory.NoSuchBeanDefinitionException;
 import org.springframework.context.ApplicationContext;
 import org.springframework.web.context.ContextLoaderListener;
 import org.springframework.web.context.support.WebApplicationContextUtils;
@@ -341,10 +342,14 @@
     public static void flushAuthenticationUserCache(String userName) {                  
             
         ApplicationContext ctx = 
             WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext);
-        UserCache userCache = (UserCache)ctx.getBean("userCache");
-        if (userCache != null) {
-            userCache.removeUserFromCache(userName);
-        }
+		try {
+			UserCache userCache = (UserCache) ctx.getBean("userCache");
+			if (userCache != null) {
+				userCache.removeUserFromCache(userName);
+			}
+		} catch (NoSuchBeanDefinitionException exc) {
+			log.debug("No userCache bean in context", exc);
+		}
     }
  
     

Modified: roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/ui/struts2/admin/ModifyUser.java
URL: http://svn.apache.org/viewvc/roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/ui/struts2/admin/ModifyUser.java?rev=917358&r1=917357&r2=917358&view=diff
==============================================================================
--- roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/ui/struts2/admin/ModifyUser.java
(original)
+++ roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/ui/struts2/admin/ModifyUser.java
Mon Mar  1 02:37:20 2010
@@ -73,7 +73,7 @@
     public void myPrepare() {
         
         // load the user object we are modifying
-        if(getUserName() != null) {
+        if (getUserName() != null) {
             try {
                 UserManager mgr = WebloggerFactory.getWeblogger().getUserManager();
                 
@@ -83,12 +83,12 @@
             } catch(Exception e) {
                 log.error("Error looking up user - "+getUserName(), e);
             }
-        } else if(getBean().getId() != null) {
+        } else if (getBean().getId() != null) {
             try {
                 UserManager mgr = WebloggerFactory.getWeblogger().getUserManager();
-                setUser(mgr.getUserByUserName(getBean().getUserName()));
-            } catch(Exception e) {
-                log.error("Error looking up user - "+getBean().getId(), e);
+                setUser(mgr.getUserByUserName(getBean().getUserName(), null));
+            } catch (Exception e) {
+                log.error("Error looking up user - " + getBean().getId(), e);
             }
         }
     }



Mime
View raw message