roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject svn commit: r920056 - /roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/ui/core/security/RollerUserDetailsService.java
Date Sun, 07 Mar 2010 18:58:56 GMT
Author: snoopdave
Date: Sun Mar  7 18:58:56 2010
New Revision: 920056

URL: http://svn.apache.org/viewvc?rev=920056&view=rev
Log:
Improved error handling needed for remember me

Modified:
    roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/ui/core/security/RollerUserDetailsService.java

Modified: roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/ui/core/security/RollerUserDetailsService.java
URL: http://svn.apache.org/viewvc/roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/ui/core/security/RollerUserDetailsService.java?rev=920056&r1=920055&r2=920056&view=diff
==============================================================================
--- roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/ui/core/security/RollerUserDetailsService.java
(original)
+++ roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/ui/core/security/RollerUserDetailsService.java
Sun Mar  7 18:58:56 2010
@@ -1,6 +1,8 @@
 package org.apache.roller.weblogger.ui.core.security;
 
 import java.util.List;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.springframework.security.GrantedAuthority;
 import org.springframework.security.GrantedAuthorityImpl;
 import org.springframework.security.userdetails.UserDetails;
@@ -20,11 +22,20 @@
  * Spring Security UserDetailsService implemented using Weblogger API.
  */
 public class RollerUserDetailsService implements UserDetailsService {
-      
+    private static Log log = LogFactory.getLog(RollerUserDetailsService.class);
+    
     public UserDetails loadUserByUsername(String userName) 
             throws UsernameNotFoundException, DataAccessException {
+        Weblogger roller = null;
+        try {
+            roller = WebloggerFactory.getWeblogger();
+        } catch (Exception e) {
+            // Should only happen in case of 1st time startup, setup required
+            log.debug("Ignorabale error getting Roller instance", e);
+            // Thowing a "soft" exception here allows setup to procede
+            throw new UsernameNotFoundException("User info not available yet.");
+        }
         try {
-            Weblogger roller = WebloggerFactory.getWeblogger();
             UserManager umgr = roller.getUserManager();
             User userData = null;  
             if (userName.startsWith("http://")) {



Mime
View raw message