This is an automated email from the ASF dual-hosted git repository.

jleroux pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 3d0a1331e8 Fixed: Prevents to uselessly clutter the logs up with 
SetTimeZoneFromBrowser errors (OFBIZ-13061)
3d0a1331e8 is described below

commit 3d0a1331e8ae75ae42f154df28c249721d481de3
Author: Jacques Le Roux <jacques.le.r...@les7arts.com>
AuthorDate: Thu May 2 09:55:52 2024 +0200

    Fixed: Prevents to uselessly clutter the logs up with 
SetTimeZoneFromBrowser errors (OFBIZ-13061)
    
    Fixes this error found in trunk demo log.
    SetTimeZoneFromBrowser.groovy]: (Cannot get property 'userLoginId' on null 
object)
    It happens, at least with webpos/control/SetTimeZoneFromBrowser
    It's just to prevents cluttering the logs.
---
 .../org/apache/ofbiz/common/SetTimeZoneFromBrowser.groovy  | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git 
a/framework/common/src/main/groovy/org/apache/ofbiz/common/SetTimeZoneFromBrowser.groovy
 
b/framework/common/src/main/groovy/org/apache/ofbiz/common/SetTimeZoneFromBrowser.groovy
index 232e61bada..49271f9ff2 100644
--- 
a/framework/common/src/main/groovy/org/apache/ofbiz/common/SetTimeZoneFromBrowser.groovy
+++ 
b/framework/common/src/main/groovy/org/apache/ofbiz/common/SetTimeZoneFromBrowser.groovy
@@ -21,12 +21,14 @@ package org.apache.ofbiz.common
 import org.apache.ofbiz.service.ServiceUtil
 
 Map setTimeZoneFromBrowser() {
-    userLogin = from('UserLogin').where('userLoginId', 
parameters.userLogin.userLoginId).queryFirst()
-    if (userLogin) {
-        if (!userLogin.lastTimeZone || userLogin.lastTimeZone == 'null') {
-            userLogin.lastTimeZone = parameters.localeName
-            userLogin.store()
-            return ServiceUtil.returnSuccess()
+    if (parameters?.userLogin?.userLoginId) {
+        userLogin = from('UserLogin').where('userLoginId', 
parameters.userLogin.userLoginId).queryFirst()
+        if (userLogin) {
+            if (!userLogin.lastTimeZone || userLogin.lastTimeZone == 'null') {
+                userLogin.lastTimeZone = parameters.localeName
+                userLogin.store()
+                return ServiceUtil.returnSuccess()
+            }
         }
     }
     // Do nothing if no userLogin to prevents to uselessly clutter the logs up 
with very common SetTimeZoneFromBrowser errors

Reply via email to