rickyma commented on a change in pull request #3199:
URL: https://github.com/apache/ambari/pull/3199#discussion_r436652748



##########
File path: 
ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostStateEntity.java
##########
@@ -137,7 +137,7 @@ public boolean equals(Object o) {
 
     HostStateEntity that = (HostStateEntity) o;
 
-    if (hostId != null ? hostId != that.hostId : that.hostId != null) return 
false;
+    if (hostId != null ? !hostId.equals(that.hostId) : that.hostId != null) 
return false;

Review comment:
       @virajjasani Thanks for your suggestion. It's done.

##########
File path: 
ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostStateEntity.java
##########
@@ -137,7 +139,7 @@ public boolean equals(Object o) {
 
     HostStateEntity that = (HostStateEntity) o;
 
-    if (hostId != null ? hostId != that.hostId : that.hostId != null) return 
false;
+    if (hostId != null ? !Objects.equals(hostId, that.hostId) : that.hostId != 
null) return false;

Review comment:
       It's done. Need I change all the codes left in equal() method using 
Objects.equals?

##########
File path: 
ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostStateEntity.java
##########
@@ -137,7 +139,7 @@ public boolean equals(Object o) {
 
     HostStateEntity that = (HostStateEntity) o;
 
-    if (hostId != null ? hostId != that.hostId : that.hostId != null) return 
false;
+    if (hostId != null ? !Objects.equals(hostId, that.hostId) : that.hostId != 
null) return false;

Review comment:
       It's done. I have also changed hashCode() as well, using Objects.hash(). 
Please have a look.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to