svn commit: r564344 - /ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r564344 - /ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java

jonesde
Author: jonesde
Date: Thu Aug  9 12:25:35 2007
New Revision: 564344

URL: http://svn.apache.org/viewvc?view=rev&rev=564344
Log:
A little better handling of the rare case where the userLoginId is missing or bad; avoid an NPE and give a better error message

Modified:
    ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java

Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java?view=diff&rev=564344&r1=564343&r2=564344
==============================================================================
--- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java (original)
+++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java Thu Aug  9 12:25:35 2007
@@ -142,6 +142,10 @@
     }
 
     public static void setLoggedOut(String userLoginId, GenericDelegator delegator) {
+        if (UtilValidate.isEmpty(userLoginId)) {
+            Debug.logWarning("Called setLogged out with empty userLoginId", module);
+        }
+        
         Transaction parentTx = null;
         boolean beganTransaction = false;
 
@@ -156,8 +160,12 @@
                 beganTransaction = TransactionUtil.begin();
 
                 GenericValue userLogin = delegator.findByPrimaryKey("UserLogin", UtilMisc.toMap("userLoginId", userLoginId));
-                userLogin.set("hasLoggedOut", "Y");
-                userLogin.store();
+                if (userLogin == null) {
+                    Debug.logError("Could not find UserLogin record for setLoggedOut with userLoginId [" + userLoginId + "]", module);
+                } else {
+                    userLogin.set("hasLoggedOut", "Y");
+                    userLogin.store();
+                }
             } catch (GenericEntityException e) {
                 String errMsg = "Unable to set logged out flag on UserLogin";
                 Debug.logError(e, errMsg, module);