This is an automated email from the ASF dual-hosted git repository.
mridulpathak pushed a commit to branch release24.09
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git
The following commit(s) were added to refs/heads/release24.09 by this push:
new c0693c2453 Keep FlexibleServletAccessor.hashCode from failing on a
null name
c0693c2453 is described below
commit c0693c24535005b9ed9302b3665ea2dbe8954a24
Author: Mridul Pathak <[email protected]>
AuthorDate: Fri Oct 30 10:48:52 2026 +0530
Keep FlexibleServletAccessor.hashCode from failing on a null name
FlexibleServletAccessor accepts a null name and its equals method compares
null names safely, but hashCode called name.hashCode() and threw a
NullPointerException for such an accessor. hashCode now uses Objects.hashCode,
so it agrees with equals.
---
.../apache/ofbiz/base/util/collections/FlexibleServletAccessor.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git
a/framework/base/src/main/java/org/apache/ofbiz/base/util/collections/FlexibleServletAccessor.java
b/framework/base/src/main/java/org/apache/ofbiz/base/util/collections/FlexibleServletAccessor.java
index c8d38c5dcf..debd3c3663 100644
---
a/framework/base/src/main/java/org/apache/ofbiz/base/util/collections/FlexibleServletAccessor.java
+++
b/framework/base/src/main/java/org/apache/ofbiz/base/util/collections/FlexibleServletAccessor.java
@@ -21,6 +21,7 @@ package org.apache.ofbiz.base.util.collections;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
+import java.util.Objects;
import javax.servlet.ServletRequest;
import javax.servlet.http.HttpSession;
@@ -170,7 +171,7 @@ public class FlexibleServletAccessor<T> implements
Serializable {
*/
@Override
public int hashCode() {
- return this.name.hashCode();
+ return Objects.hashCode(this.name);
}
/**