Elffuss BraidHub

kikocis/java-driver public

JAVA-942: Fix implementation of UserType.hashCode()
Changesete2350e90e9417599e1847bda8773676bd29eeea872e9b325ee09c34ed490e41e
AuthorAlexandre Dutra <alexandre.dutra@datastax.com> · 2015-10-08 13:00 +02:00
Committerolim7t <omichallat+github@gmail.com> · 2015-10-12 11:50 +02:00
Parentsb32f1acac85e

Browse the files at this changeset

2 files changed

modified changelog/README.md +1 −50
@@ -3,6 +3,7 @@
33 ### 3.0.0-beta1
44
55 - [improvement] Change default consistency level to LOCAL_QUORUM (JAVA-926)
6+- [bug] Fix implementation of UserType.hashCode() (JAVA-942)
67
78
89 ### 3.0.0-alpha3
@@ -89,56 +90,6 @@
8990 - [improvement] Support custom type codecs in mapper (JAVA-722)
9091
9192
92-### 2.2.0-rc4 (in progress)
93-
94-Merged from 2.0 branch:
95-
96-- [improvement] Log streamid at the trace level on sending request and receiving response (JAVA-718)
97-- [bug] Fix SpeculativeExecutionPolicy.init() and close() are never called (JAVA-796)
98-- [improvement] Suppress unnecessary warning at shutdown (JAVA-710)
99-- [improvement] Allow DNS name with multiple A-records as contact point (#340)
100-- [bug] Allow tracing across multiple result pages (JAVA-794)
101-- [bug] DowngradingConsistencyRetryPolicy ignores write timeouts (JAVA-737)
102-- [bug] Forbid bind marker in QueryBuilder add/append/prepend (JAVA-736)
103-- [bug] Prevent QueryBuilder.quote() from applying duplicate double quotes (JAVA-712)
104-- [bug] Prevent QueryBuilder from trying to serialize raw string (JAVA-688)
105-- [bug] Support bind marker in QueryBuilder DELETE's list index (JAVA-679)
106-- [improvement] Improve QueryBuilder API for SELECT DISTINCT (JAVA-475)
107-- [improvement] Create values() function for Insert builder using List (JAVA-225)
108-- [improvement] Warn when ReplicationStrategy encounters invalid
109- replication factors (JAVA-702)
110-- [improvement] Add PoolingOptions method to set both core and max
111- connections (JAVA-662).
112-- [improvement] Do not include epoll JAR in binary distribution (JAVA-766)
113-- [improvement] Optimize internal copies of Request objects (JAVA-726)
114-- [bug] Preserve tracing across retries (JAVA-815)
115-- [improvement] New RetryDecision.tryNextHost() (JAVA-709)
116-- [bug] Handle function calls and raw strings as non-idempotent in QueryBuilder (JAVA-733)
117-- [improvement] Provide API to retrieve values of a Parameterized SimpleStatement (JAVA-765)
118-- [improvement] implement UPDATE ... IF EXISTS in QueryBuilder (JAVA-827)
119-- [improvement] Randomize contact points list to prevent hotspots (JAVA-618)
120-- [improvement] Surface the coordinator used on query failure (JAVA-720)
121-- [bug] Handle contact points removed during init (JAVA-792)
122-- [improvement] Allow PlainTextAuthProvider to change its credentials at runtime (JAVA-719)
123-- [new feature] Make it possible to register for SchemaChange Events (JAVA-151)
124-- [improvement] Downgrade "Asked to rebuild table" log from ERROR to INFO level (JAVA-861)
125-- [improvement] Provide an option to prepare statements only on one node (JAVA-797)
126-- [improvement] Provide an option to not re-prepare all statements in onUp (JAVA-658)
127-- [improvement] Customizable creation of netty timer (JAVA-853)
128-- [bug] Avoid quadratic ring processing with invalid replication factors (JAVA-859)
129-- [improvement] Debounce control connection queries (JAVA-657)
130-- [bug] LoadBalancingPolicy.distance() called before init() (JAVA-784)
131-- [new feature] Make driver-side metadata optional (JAVA-828)
132-- [improvement] Allow hosts to remain partially up (JAVA-544)
133-- [improvement] Remove internal blocking calls and expose async session
134- creation (JAVA-821, JAVA-822)
135-- [improvement] Use parallel calls when re-preparing statement on other
136- hosts (JAVA-725)
137-- [bug] Don't use connection timeout for unrelated internal queries (JAVA-629)
138-- [bug] Fix NPE in speculative executions when metrics disabled
139- (JAVA-892)
140-
141-
14293 ### 2.2.0-rc3
14394
14495 - [bug] Propagate CodecRegistry to nested UDTs (JAVA-847)
modified driver-core/src/main/java/com/datastax/driver/core/UserType.java +8 −3
@@ -170,8 +170,12 @@
170170 }
171171
172172 @Override
173- public final int hashCode() {
174- return Arrays.hashCode(new Object[]{ name, keyspace, typeName, byIdx });
173+ public int hashCode() {
174+ int result = name.hashCode();
175+ result = 31 * result + keyspace.hashCode();
176+ result = 31 * result + typeName.hashCode();
177+ result = 31 * result + Arrays.hashCode(byIdx);
178+ return result;
175179 }
176180
177181 @Override
@@ -183,7 +187,8 @@
183187
184188 // Note: we don't test byName because it's redundant with byIdx in practice,
185189 // but also because the map holds 'int[]' which don't have proper equal.
186- return keyspace.equals(other.keyspace)
190+ return name.equals(other.name)
191+ && keyspace.equals(other.keyspace)
187192 && typeName.equals(other.typeName)
188193 && Arrays.equals(byIdx, other.byIdx);
189194 }