[#2045] Bad hashCode calculation when Records contain arrays or byte[]

This commit is contained in:
Lukas Eder 2012-12-22 20:46:49 +01:00
parent d756297151
commit 5cfde0af20

View File

@ -118,7 +118,19 @@ abstract class AbstractStore implements AttachableInternal {
for (int i = 0; i < size(); i++) {
final Object obj = getValue(i);
hashCode = 31 * hashCode + (obj == null ? 0 : obj.hashCode());
if (obj == null) {
hashCode = 31 * hashCode;
}
// [#985] [#2045] Don't use obj.hashCode() on arrays, but avoid
// calculating it as byte[] (BLOBs) can be quite large
else if (obj.getClass().isArray()) {
hashCode = 31 * hashCode;
}
else {
hashCode = 31 * hashCode + obj.hashCode();
}
}
return hashCode;