You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2017/07/10 19:00:01 UTC
[jira] [Commented] (FLINK-7127) Remove unnecessary null check or
add null check
[ https://issues.apache.org/jira/browse/FLINK-7127?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16080879#comment-16080879 ]
ASF GitHub Bot commented on FLINK-7127:
---------------------------------------
GitHub user mylog00 opened a pull request:
https://github.com/apache/flink/pull/4294
[FLINK-7127] [runtime] Remove unnecessary null check or add null check;
Hi. To avoid NPE I decided add null check instead remove it one.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/mylog00/flink FLINK-7127
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/flink/pull/4294.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #4294
----
commit 547902bd1426607a4d63c8ff15674cc1d7e1ad65
Author: Dmitrii Kniazev <my...@ya.ru>
Date: 2017-07-10T18:41:32Z
[FLINK-7127] [runtime] Remove unnecessary null check or add null check;
----
> 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)