Elffuss BraidHub

kikocis/java-driver public

Merge pull request #648 from datastax/java1156

JAVA-1156: Fix NPE at TableMetadata.equals().
Changeset8e4ed2ba40a73b7f08bbb72c18f1651febf9d3a1f2812a4c37d159d122b71774
AuthorAlexandre Dutra <adutra@users.noreply.github.com> · 2016-04-08 18:12 +02:00
CommitterAlexandre Dutra <adutra@users.noreply.github.com> · 2016-04-08 18:12 +02:00
Parents7853953cb7e6, 4d70731b99d5

Browse the files at this changeset

2 files changed

modified changelog/README.md +2 −1
@@ -2,7 +2,8 @@
22
33 ### 2.1.10.1 (in progress)
44
5-[bug] JAVA-1152: Fix NPE at ControlConnection.refreshNodeListAndTokenMap().
5+- [bug] JAVA-1152: Fix NPE at ControlConnection.refreshNodeListAndTokenMap().
6+- [bug] JAVA-1156: Fix NPE at TableMetadata.equals().
67
78
89 ### 2.1.10
modified driver-core/src/main/java/com/datastax/driver/core/TableMetadata.java +11 −28
@@ -15,6 +15,7 @@
1515 */
1616 package com.datastax.driver.core;
1717
18+import com.google.common.base.Objects;
1819 import com.google.common.base.Predicate;
1920 import com.google.common.collect.ImmutableMap;
2021 import com.google.common.collect.Iterables;
@@ -394,39 +395,21 @@
394395
395396 @Override
396397 public boolean equals(Object o) {
397- if (this == o)
398- return true;
399- if (o == null || getClass() != o.getClass())
400- return false;
401-
398+ if (this == o) return true;
399+ if (o == null || getClass() != o.getClass()) return false;
402400 TableMetadata that = (TableMetadata) o;
403-
404- if (!name.equals(that.name))
405- return false;
406- if (!partitionKey.equals(that.partitionKey))
407- return false;
408- if (!clusteringColumns.equals(that.clusteringColumns))
409- return false;
410- if (!columns.equals(that.columns))
411- return false;
412- if (!options.equals(that.options))
413- return false;
414- if (!clusteringOrder.equals(that.clusteringOrder))
415- return false;
416- return cassandraVersion.equals(that.cassandraVersion);
417-
401+ return Objects.equal(name, that.name) &&
402+ Objects.equal(partitionKey, that.partitionKey) &&
403+ Objects.equal(clusteringColumns, that.clusteringColumns) &&
404+ Objects.equal(columns, that.columns) &&
405+ Objects.equal(options, that.options) &&
406+ Objects.equal(clusteringOrder, that.clusteringOrder) &&
407+ Objects.equal(cassandraVersion, that.cassandraVersion);
418408 }
419409
420410 @Override
421411 public int hashCode() {
422- int result = name.hashCode();
423- result = 31 * result + partitionKey.hashCode();
424- result = 31 * result + clusteringColumns.hashCode();
425- result = 31 * result + columns.hashCode();
426- result = 31 * result + options.hashCode();
427- result = 31 * result + clusteringOrder.hashCode();
428- result = 31 * result + cassandraVersion.hashCode();
429- return result;
412+ return Objects.hashCode(name, partitionKey, clusteringColumns, columns, options, clusteringOrder, cassandraVersion);
430413 }
431414
432415 private String asCQLQuery(boolean formatted) {