diff options
author | gjoranv <gv@verizonmedia.com> | 2020-04-02 02:34:48 +0200 |
---|---|---|
committer | gjoranv <gv@verizonmedia.com> | 2020-04-02 10:32:35 +0200 |
commit | 6e5eb6ff02915a2f1fab382b5cff67b68af883f9 (patch) | |
tree | f9da28e04a3625eab23efc4fc9e77e6571e6162f /config-lib | |
parent | df05ca322bca04cc4c12b2e6bdaa252b10e50e7c (diff) |
Safeguard against adding disk bundles to allowed duplicates.
This should not be necessary, because disk bundles should be
removed by getObsoleteFileReferences (as long as they are
present in both the old and new set of bundles). However, there
was an incident where all the model amender's bundles were added
to the set of allowed duplicates. One possible explanation is that
FileReference.equals or hashCode was broken, so an improved
version is added by this commit.
Diffstat (limited to 'config-lib')
-rwxr-xr-x | config-lib/src/main/java/com/yahoo/config/FileReference.java | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/config-lib/src/main/java/com/yahoo/config/FileReference.java b/config-lib/src/main/java/com/yahoo/config/FileReference.java index 3b95c2fbd4c..ee99ebfa2b7 100755 --- a/config-lib/src/main/java/com/yahoo/config/FileReference.java +++ b/config-lib/src/main/java/com/yahoo/config/FileReference.java @@ -28,14 +28,16 @@ public final class FileReference { } @Override - public int hashCode() { - return value.hashCode(); + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + FileReference that = (FileReference) o; + return value.equals(that.value); } @Override - public boolean equals(Object other) { - return other instanceof FileReference && - value.equals(((FileReference)other).value); + public int hashCode() { + return Objects.hash(value); } @Override |