DBZ-759 Fix equality comparison for BinaryValue

If value is binary or string, it should be better to compare the content
of the actual byte arrays.
According to ErrorProne you use reference equality when calling equals on
an array.

Part of https://issues.jboss.org/browse/DBZ-759
This commit is contained in:
Andreas Bergmeier 2018-06-21 16:09:10 +02:00 committed by Gunnar Morling
parent 333d6cb57d
commit 7417baea4d

View File

@ -38,8 +38,8 @@ public boolean equals(Object obj) {
if (obj instanceof Value) {
Value that = (Value) obj;
if (that.isNull()) return false;
if (that.isBinary()) return this.value.equals(that.asBytes());
if (that.isString()) return this.value.equals(that.asString().getBytes());
if (that.isBinary()) return Arrays.equals(this.value, that.asBytes());
if (that.isString()) return Arrays.equals(this.value, that.asString().getBytes());
return false;
}
return false;