commit | 0132666d5aa668455a2a45d82bc1f62bd1365998 | [log] [tgz] |
---|---|---|
author | Matthias Sohn <matthias.sohn@sap.com> | Fri Dec 04 11:21:08 2020 +0100 |
committer | Matthias Sohn <matthias.sohn@sap.com> | Tue Dec 22 10:52:59 2020 +0100 |
tree | 8c6a922461465255e37ca857929c078f984d4695 | |
parent | fa0e77e8f92d0710caf75085af1e6fb50b7d942d [diff] |
[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>
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileReftableStack.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileReftableStack.java index bc2039c..db454b9 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileReftableStack.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileReftableStack.java
@@ -636,6 +636,9 @@ @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;