flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zhangminglei <...@git.apache.org>
Subject [GitHub] flink pull request #4328: [FLINK-6493] Fix ineffective null check in Registe...
Date Thu, 03 Aug 2017 12:20:14 GMT
Github user zhangminglei commented on a diff in the pull request:

    https://github.com/apache/flink/pull/4328#discussion_r131125429
  
    --- Diff: flink-runtime/src/main/java/org/apache/flink/runtime/state/RegisteredOperatorBackendStateMetaInfo.java
---
    @@ -175,14 +176,19 @@ public boolean equals(Object obj) {
     				return false;
     			}
     
    +			if (!(obj instanceof Snapshot)) {
    +				return false;
    +			}
    +
    +			Snapshot snapshot = (Snapshot)obj;
    +
     			// need to check for nulls because serializer and config snapshots may be null on
restore
    -			return (obj instanceof Snapshot)
    -				&& name.equals(((Snapshot) obj).getName())
    -				&& assignmentMode.equals(((Snapshot) obj).getAssignmentMode())
    -				&& ((partitionStateSerializer == null && ((Snapshot) obj).getPartitionStateSerializer()
== null)
    -					|| partitionStateSerializer.equals(((Snapshot) obj).getPartitionStateSerializer()))
    -				&& ((partitionStateSerializerConfigSnapshot == null && ((Snapshot)
obj).getPartitionStateSerializerConfigSnapshot() == null)
    -					|| partitionStateSerializerConfigSnapshot.equals(((Snapshot) obj).getPartitionStateSerializerConfigSnapshot()));
    +			return Objects.equals(name, snapshot.getName())
    +				&& Objects.equals(assignmentMode, snapshot.getAssignmentMode())
    --- End diff --
    
    Yes. You are right. I did this because I want make them have the same way, Objects.equal.
Now, I will return to the previously method. Thanks ~


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message