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

ASF GitHub Bot commented on FLINK-7402:
---------------------------------------

Github user NicoK commented on a diff in the pull request:

    https://github.com/apache/flink/pull/4562#discussion_r134166175
  
    --- Diff: 
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/netty/NettyMessage.java
 ---
    @@ -220,6 +220,10 @@ void releaseBuffer() {
     
                @Override
                ByteBuf write(ByteBufAllocator allocator) throws IOException {
    +                   if (null == buffer) {
    +                           throw new NullPointerException();
    --- End diff --
    
    actually, better use `Preconditions#checkNotNull(T)` - an additional error 
message there usually does not make too much sense as the failure is clear


> Ineffective null check in NettyMessage#write()
> ----------------------------------------------
>
>                 Key: FLINK-7402
>                 URL: https://issues.apache.org/jira/browse/FLINK-7402
>             Project: Flink
>          Issue Type: Bug
>          Components: Network
>            Reporter: Ted Yu
>            Priority: Minor
>
> Here is the null check in finally block:
> {code}
>       finally {
>         if (buffer != null) {
>           buffer.recycle();
>         }
> {code}
> But buffer has been dereferenced in the try block without guard.



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

Reply via email to