You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Stephan Ewen (JIRA)" <ji...@apache.org> on 2015/12/03 11:03:11 UTC

[jira] [Commented] (FLINK-3104) Potential null dereference of outStream in FsStateBackend#CheckpointStateOutputStream#closeAndGetHandle()

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

Stephan Ewen commented on FLINK-3104:
-------------------------------------

This is actually not a problem. The contract is that after {{flush()}}, the stream cannot be null.

> Potential null dereference of outStream in FsStateBackend#CheckpointStateOutputStream#closeAndGetHandle()
> ---------------------------------------------------------------------------------------------------------
>
>                 Key: FLINK-3104
>                 URL: https://issues.apache.org/jira/browse/FLINK-3104
>             Project: Flink
>          Issue Type: Bug
>            Reporter: Ted Yu
>            Priority: Minor
>
> Here is related code:
> {code}
>           if (outStream == null && pos <= localStateThreshold) {
>             closed = true;
>             byte[] bytes = Arrays.copyOf(writeBuffer, pos);
>             return new ByteStreamStateHandle(bytes);
>           }
>           else {
>             flush();
>             outStream.close();
> {code}
> The if condition checks both outStream and pos.
> In the else block, outStream may be null, leading to NPE.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)