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

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

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

    https://github.com/apache/flink/pull/6166#discussion_r195774420
  
    --- Diff: 
flink-runtime/src/main/java/org/apache/flink/runtime/rest/RestClient.java ---
    @@ -292,30 +292,49 @@ private void readRawResponse(FullHttpResponse msg) {
                        ByteBuf content = msg.content();
     
                        JsonNode rawResponse;
    +                   InputStream in = null;
                        try {
    -                           InputStream in = new 
ByteBufInputStream(content);
    +                           in = new ByteBufInputStream(content);
                                rawResponse = objectMapper.readTree(in);
                                LOG.debug("Received response {}.", rawResponse);
                        } catch (JsonParseException je) {
                                LOG.error("Response was not valid JSON.", je);
                                // let's see if it was a plain-text message 
instead
                                content.readerIndex(0);
    +                           ByteBufInputStream inputStream = null;
                                try {
    -                                   ByteBufInputStream in = new 
ByteBufInputStream(content);
    +                                   inputStream = new 
ByteBufInputStream(content);
    --- End diff --
    
    ditto?


> Potentially unclosed ByteBufInputStream in RestClient#readRawResponse
> ---------------------------------------------------------------------
>
>                 Key: FLINK-9580
>                 URL: https://issues.apache.org/jira/browse/FLINK-9580
>             Project: Flink
>          Issue Type: Bug
>            Reporter: Ted Yu
>            Assignee: vinoyang
>            Priority: Minor
>
> Here is related code:
> {code}
>           ByteBufInputStream in = new ByteBufInputStream(content);
>           byte[] data = new byte[in.available()];
>           in.readFully(data);
> {code}
> In the catch block, ByteBufInputStream is not closed.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to