[ 
https://issues.apache.org/jira/browse/FLINK-6493?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16085054#comment-16085054
 ] 

mingleizhang edited comment on FLINK-6493 at 7/13/17 2:29 AM:
--------------------------------------------------------------

Actually, Sorry. I dont think null check is ineffective, as it just combination 
with another clause which belongs to not empty constructor has 
{{Preconditions.checkNotNull}}. In empty constructor, it does not have a null 
check. Even though,it would be still throw an NPE when call 
{{partitionStateSerializer.equals()}} if {{partitionStateSerializer}} is null 
and {{((Snapshot) obj).getPartitionStateSerializer() == null}} return a false. 
So, I believe in this case, we should return a false instead of throw an NPE.


was (Author: mingleizhang):
Actually, Sorry. I dont think null check is ineffective, as it just combination 
with another clause which belongs to not empty constructor has 
{{Preconditions.checkNotNull}}. In empty constructor, it does not have a null 
check. Even though,it would be still throw an NPE when call 
{{partitionStateSerializer.equals()}} if {{partitionStateSerializer}} is null 
and {{((Snapshot) obj).getPartitionStateSerializer() == null}} return a false. 
So, I believe in this case, we should return a false instead throw an NPE.

> Ineffective null check in RegisteredOperatorBackendStateMetaInfo#equals()
> -------------------------------------------------------------------------
>
>                 Key: FLINK-6493
>                 URL: https://issues.apache.org/jira/browse/FLINK-6493
>             Project: Flink
>          Issue Type: Bug
>          Components: State Backends, Checkpointing
>            Reporter: Ted Yu
>            Assignee: mingleizhang
>            Priority: Minor
>
> {code}
>         && ((partitionStateSerializer == null && ((Snapshot) 
> obj).getPartitionStateSerializer() == null)
>           || partitionStateSerializer.equals(((Snapshot) 
> obj).getPartitionStateSerializer()))
>         && ((partitionStateSerializerConfigSnapshot == null && ((Snapshot) 
> obj).getPartitionStateSerializerConfigSnapshot() == null)
>           || partitionStateSerializerConfigSnapshot.equals(((Snapshot) 
> obj).getPartitionStateSerializerConfigSnapshot()));
> {code}
> The null check for partitionStateSerializer / 
> partitionStateSerializerConfigSnapshot is in combination with another clause.
> This may lead to NPE in the partitionStateSerializer.equals() call.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to