kikocis/java-driver public
Changesets · Branches · Tags · Compare
| Changeset | 0d619c82c5fa97ac7ceea725220ce4fd91110f405de23c95a54fdcf107d1aaa4 |
|---|---|
| Author | Alexandre Dutra <alexandre.dutra@datastax.com> · 2015-10-08 13:00 +02:00 |
| Committer | olim7t <omichallat+github@gmail.com> · 2015-10-12 11:54 +02:00 |
| Parents | 98a9d75ec57e |
2 files changed
modified changelog/README.md +5 −0
| @@ -1,5 +1,10 @@ | ||
| 1 | 1 | ## Changelog |
| 2 | 2 | |
| 3 | +### 2.1.9 (in progress) | |
| 4 | + | |
| 5 | +- [bug] Fix implementation of UserType.hashCode() (JAVA-942) | |
| 6 | + | |
| 7 | + | |
| 3 | 8 | ### 2.1.8 |
| 4 | 9 | |
| 5 | 10 | Merged from 2.0 branch: |
modified driver-core/src/main/java/com/datastax/driver/core/UserType.java +7 −2
| @@ -179,7 +179,11 @@ | ||
| 179 | 179 | |
| 180 | 180 | @Override |
| 181 | 181 | public final int hashCode() { |
| 182 | - return Arrays.hashCode(new Object[]{ name, keyspace, typeName, byIdx }); | |
| 182 | + int result = name.hashCode(); | |
| 183 | + result = 31 * result + keyspace.hashCode(); | |
| 184 | + result = 31 * result + typeName.hashCode(); | |
| 185 | + result = 31 * result + Arrays.hashCode(byIdx); | |
| 186 | + return result; | |
| 183 | 187 | } |
| 184 | 188 | |
| 185 | 189 | @Override |
| @@ -191,7 +195,8 @@ | ||
| 191 | 195 | |
| 192 | 196 | // Note: we don't test byName because it's redundant with byIdx in practice, |
| 193 | 197 | // but also because the map holds 'int[]' which don't have proper equal. |
| 194 | - return keyspace.equals(other.keyspace) | |
| 198 | + return name.equals(other.name) | |
| 199 | + && keyspace.equals(other.keyspace) | |
| 195 | 200 | && typeName.equals(other.typeName) |
| 196 | 201 | && Arrays.equals(byIdx, other.byIdx); |
| 197 | 202 | } |