[spotbugs] Fix FileReftableStack#equals to check for null

This fixes spotbugs warning NP_EQUALS_SHOULD_HANDLE_NULL_ARGUMENT.

This implementation violated the contract defined by
java.lang.Object.equals() because it did not check for null being passed
as the argument. All equals() methods should return false if passed a
null value.

Change-Id: I607f6979613d390aae2f3546b587f63133d6d73c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
This commit is contained in:
Matthias Sohn 2020-12-04 11:21:08 +01:00
parent fa0e77e8f9
commit 0132666d5a
1 changed files with 3 additions and 0 deletions

View File

@ -636,6 +636,9 @@ public int hashCode() {
@Override
public boolean equals(Object other) {
if (other == null) {
return false;
}
Segment o = (Segment) other;
return o.bytes == bytes && o.log == log && o.start == start
&& o.end == end;