[
https://issues.apache.org/jira/browse/FLINK-7127?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16112291#comment-16112291
]
ASF GitHub Bot commented on FLINK-7127:
---------------------------------------
Github user tzulitai commented on the issue:
https://github.com/apache/flink/pull/4349
One other thing:
For commit messages, they should convey the exact final fix.
So, instead of "Remove unnecessary null check OR add null check", it should
simply state how it is fixed. I'll adjust it appropriately this time for you :)
> Remove unnecessary null check or add null check
> -----------------------------------------------
>
> Key: FLINK-7127
> URL: https://issues.apache.org/jira/browse/FLINK-7127
> Project: Flink
> Issue Type: Improvement
> Components: State Backends, Checkpointing
> Reporter: Ufuk Celebi
> Priority: Trivial
> Labels: starter
>
> In {{HeapKeyedStateBackend#snapshot}} we have:
> {code}
> for (Map.Entry<String, StateTable<K, ?, ?>> kvState : stateTables.entrySet())
> {
> // 1) Here we don't check for null
> metaInfoSnapshots.add(kvState.getValue().getMetaInfo().snapshot());
> kVStateToId.put(kvState.getKey(), kVStateToId.size());
> // 2) Here we check for null
> StateTable<K, ?, ?> stateTable = kvState.getValue();
> if (null != stateTable) {
> cowStateStableSnapshots.put(stateTable,
> stateTable.createSnapshot());
> }
> }
> {code}
> Either this can lead to a NPE and we should check it in 1) or we remove the
> null check in 2).
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)