This is an automated email from the ASF dual-hosted git repository. deepak pushed a commit to branch release18.12 in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git
The following commit(s) were added to refs/heads/release18.12 by this push: new d8b097f671 Replaced direct null checks on username, password, and token with UtilValidate.isEmpty() method calls for consistency. d8b097f671 is described below commit d8b097f6717a4004acf023dfe929e0e41ad63faa 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 9fe1f7f75f..2718a394a1 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 @@ -340,8 +340,8 @@ public 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 (like not checkout the hasLoggedOut field) passes; this is not a normal circumstance but can happen with custom code or in funny error situations when the userLogin service gets the userLogin object but runs into another problem and fails to return an error @@ -419,9 +419,9 @@ public 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... if (UtilValidate.isNotEmpty(request.getAttribute("USERNAME"))) {