You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Chesnay Schepler (JIRA)" <ji...@apache.org> on 2017/05/13 15:46:04 UTC

[jira] [Comment Edited] (FLINK-6530) Unclosed Response in DatadogHttpClient#validateApiKey()

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

Chesnay Schepler edited comment on FLINK-6530 at 5/13/17 3:45 PM:
------------------------------------------------------------------

The response instance is created by execute(); if an exception is thrown there's nothing to close.

That said, I'll still wrap it in a try-catch because it is never closed at the moment.


was (Author: zentol):
The response instance is created by execute(); if an exception is thrown there's nothing to close.

That said, I'll still wrap it in a try-catch to be safe.

> Unclosed Response in DatadogHttpClient#validateApiKey()
> -------------------------------------------------------
>
>                 Key: FLINK-6530
>                 URL: https://issues.apache.org/jira/browse/FLINK-6530
>             Project: Flink
>          Issue Type: Bug
>            Reporter: Ted Yu
>            Assignee: Chesnay Schepler
>            Priority: Minor
>
> Here is related code:
> {code}
>     try {
>       Response response = client.newCall(r).execute();
>       if (!response.isSuccessful()) {
>         throw new IllegalArgumentException(
>           String.format("API key: %s is invalid", apiKey));
>       }
>     } catch(IOException e) {
>       throw new IllegalStateException("Failed contacting Datadog to validate API key", e);
> {code}
> If execute() throws exception, the Response instance would be left unclosed.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)