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 628c251 Improved: Fix some bugs Spotbugs reports (OFBIZ-12386)
628c251 is described below
commit 628c25184256d1fab1ebaafb5c487b5fe62ed778
Author: Jacques Le Roux <[email protected]>
AuthorDate: Sun Dec 26 09:09:16 2021 +0100
Improved: Fix some bugs Spotbugs reports (OFBIZ-12386)
SpotBugs reports that
<<org.apache.ofbiz.base.util.collections.FlexibleServletAccessor.equals(Object)
does not check for parameter nullity
This implementation of equals(Object) does not respect the contract defined
by
java.lang.Object.equals() because it does not check the nullity of the
parameter
received as argument. All equals() methods must return false when they
receive
a null value.>>
This fixes it, but despite SpotBugs continues to report the same error,
excludes
it.
Also removes unused expandContext private var
---
.../apache/ofbiz/base/util/collections/FlexibleServletAccessor.java | 4 +++-
1 file changed, 3 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 521ede6..368784d 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
@@ -180,6 +180,9 @@ public class FlexibleServletAccessor<T> implements
Serializable {
*/
@Override
public boolean equals(Object obj) {
+ if (obj == null) {
+ return false;
+ }
if (obj instanceof FlexibleServletAccessor<?>) {
FlexibleServletAccessor<?> flexibleServletAccessor =
(FlexibleServletAccessor<?>) obj;
if (this.name == null) {
@@ -205,7 +208,6 @@ public class FlexibleServletAccessor<T> implements
Serializable {
}
protected static class AttributeAccessor<T> implements Serializable {
- private Map<String, Object> expandContext;
private String attributeName;
private FlexibleMapAccessor<T> fma;
private boolean isListReference;