From 444e0518e0ace34a6bc490ffa61fe722a322a465 Mon Sep 17 00:00:00 2001 From: MichealShin Date: Fri, 18 Jan 2019 20:21:49 +0800 Subject: [PATCH] STORM-3318: Complete information in Class NewKafkaSpoutOffsetQuery Just complete information in three methods(toString , equals, hashCode). --- .../monitor/NewKafkaSpoutOffsetQuery.java | 33 +++++++++++++++---- 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/external/storm-kafka-monitor/src/main/java/org/apache/storm/kafka/monitor/NewKafkaSpoutOffsetQuery.java b/external/storm-kafka-monitor/src/main/java/org/apache/storm/kafka/monitor/NewKafkaSpoutOffsetQuery.java index 0327ea00d94..7678ed769ce 100644 --- a/external/storm-kafka-monitor/src/main/java/org/apache/storm/kafka/monitor/NewKafkaSpoutOffsetQuery.java +++ b/external/storm-kafka-monitor/src/main/java/org/apache/storm/kafka/monitor/NewKafkaSpoutOffsetQuery.java @@ -64,20 +64,39 @@ public String toString() { "topics='" + topics + '\'' + ", consumerGroupId='" + consumerGroupId + '\'' + ", bootStrapBrokers='" + bootStrapBrokers + '\'' + + ", securityProtocol='" + securityProtocol + '\'' + + ", consumerPropertiesFileName='" + consumerPropertiesFileName + '\'' + '}'; } @Override public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } NewKafkaSpoutOffsetQuery that = (NewKafkaSpoutOffsetQuery) o; - if (topics != null ? !topics.equals(that.topics) : that.topics != null) return false; - if (consumerGroupId != null ? !consumerGroupId.equals(that.consumerGroupId) : that.consumerGroupId != null) return false; - return !(bootStrapBrokers != null ? !bootStrapBrokers.equals(that.bootStrapBrokers) : that.bootStrapBrokers != null); - + if (topics != null ? !topics.equals(that.topics) : that.topics != null) { + return false; + } + if (consumerGroupId != null ? !consumerGroupId.equals(that.consumerGroupId) + : that.consumerGroupId != null) { + return false; + } + if (bootStrapBrokers != null ? !bootStrapBrokers.equals(that.bootStrapBrokers) + : that.bootStrapBrokers != null) { + return false; + } + if (securityProtocol != null ? !securityProtocol.equals(that.securityProtocol) + : that.securityProtocol != null) { + return false; + } + return consumerPropertiesFileName != null ? consumerPropertiesFileName + .equals(that.consumerPropertiesFileName) : that.consumerPropertiesFileName == null; } @Override @@ -85,6 +104,8 @@ public int hashCode() { int result = topics != null ? topics.hashCode() : 0; result = 31 * result + (consumerGroupId != null ? consumerGroupId.hashCode() : 0); result = 31 * result + (bootStrapBrokers != null ? bootStrapBrokers.hashCode() : 0); + result = 31 * result + (securityProtocol != null ? securityProtocol.hashCode() : 0); + result = 31 * result + (consumerPropertiesFileName != null ? consumerPropertiesFileName.hashCode() : 0); return result; } }