This is an automated email from the ASF dual-hosted git repository. deepak pushed a commit to branch release22.01 in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git
The following commit(s) were added to refs/heads/release22.01 by this push: new 47e7959065 Replaced direct null checks on username, password, and token with UtilValidate.isEmpty() method calls for consistency. 47e7959065 is described below commit 47e7959065b82b170da5c330ed5c17af16415ede Author: Deepak Dixit <deepak.di...@hotwax.co> AuthorDate: Thu Dec 14 17:29:28 2023 +0530 Replaced direct null checks on username, password, and token with UtilValidate.isEmpty() method calls for consistency. --- .../main/java/org/apache/ofbiz/webapp/control/LoginWorker.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/LoginWorker.java b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/LoginWorker.java index d5895d9a1a..0bb861e3d4 100644 --- a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/LoginWorker.java +++ b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/LoginWorker.java @@ -338,8 +338,8 @@ public final class LoginWorker { if (token == null) token = (String) session.getAttribute("TOKEN"); // in this condition log them in if not already; if not logged in or can't log in, save parameters and return error - if (username == null - || (password == null && token == null) + if (UtilValidate.isEmpty(username) + || (UtilValidate.isEmpty(password) && UtilValidate.isEmpty(token)) || "error".equals(login(request, response))) { // make sure this attribute is not in the request; this avoids infinite recursion when a login by less stringent criteria @@ -417,9 +417,9 @@ public final class LoginWorker { } } - if (username == null) username = (String) session.getAttribute("USERNAME"); - if (password == null) password = (String) session.getAttribute("PASSWORD"); - if (token == null) token = (String) session.getAttribute("TOKEN"); + if (UtilValidate.isEmpty(username)) username = (String) session.getAttribute("USERNAME"); + if (UtilValidate.isEmpty(password)) password = (String) session.getAttribute("PASSWORD"); + if (UtilValidate.isEmpty(token)) token = (String) session.getAttribute("TOKEN"); // allow a username and/or password in a request attribute to override the request parameter or the session attribute; // this way a preprocessor can play with these a bit...