Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-6530

Unclosed Response in DatadogHttpClient#validateApiKey()

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.3.0, 1.4.0
    • Component/s: None
    • Labels:
      None

      Description

      Here is related 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);
      

      If execute() throws exception, the Response instance would be left unclosed.

        Issue Links

          Activity

          Hide
          Zentol Chesnay Schepler added a comment - - edited

          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.

          Show
          Zentol Chesnay Schepler added a comment - - edited 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.
          Hide
          githubbot ASF GitHub Bot added a comment -

          GitHub user zentol opened a pull request:

          https://github.com/apache/flink/pull/3892

          FLINK-6530 Close response in DatadogHttpClient

          You can merge this pull request into a Git repository by running:

          $ git pull https://github.com/zentol/flink 6530_datadog_response

          Alternatively you can review and apply these changes as the patch at:

          https://github.com/apache/flink/pull/3892.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 #3892


          commit 74d2dbad03ebe0f41e42cfe5bf94255d01492e05
          Author: zentol <chesnay@apache.org>
          Date: 2017-05-13T15:45:46Z

          FLINK-6530 Close response in DatadogHttpClient


          Show
          githubbot ASF GitHub Bot added a comment - GitHub user zentol opened a pull request: https://github.com/apache/flink/pull/3892 FLINK-6530 Close response in DatadogHttpClient You can merge this pull request into a Git repository by running: $ git pull https://github.com/zentol/flink 6530_datadog_response Alternatively you can review and apply these changes as the patch at: https://github.com/apache/flink/pull/3892.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 #3892 commit 74d2dbad03ebe0f41e42cfe5bf94255d01492e05 Author: zentol <chesnay@apache.org> Date: 2017-05-13T15:45:46Z FLINK-6530 Close response in DatadogHttpClient
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user tedyu commented on the issue:

          https://github.com/apache/flink/pull/3892

          lgtm

          Show
          githubbot ASF GitHub Bot added a comment - Github user tedyu commented on the issue: https://github.com/apache/flink/pull/3892 lgtm
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user zentol commented on the issue:

          https://github.com/apache/flink/pull/3892

          merging.

          Show
          githubbot ASF GitHub Bot added a comment - Github user zentol commented on the issue: https://github.com/apache/flink/pull/3892 merging.
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user asfgit closed the pull request at:

          https://github.com/apache/flink/pull/3892

          Show
          githubbot ASF GitHub Bot added a comment - Github user asfgit closed the pull request at: https://github.com/apache/flink/pull/3892
          Hide
          Zentol Chesnay Schepler added a comment -

          1.3: 81d520bbf9bffb6e37f4787ab4bc455f814c3b00
          1.4: 50c88d5b14d58f138a3c95d31e3702f01c459e3f

          Show
          Zentol Chesnay Schepler added a comment - 1.3: 81d520bbf9bffb6e37f4787ab4bc455f814c3b00 1.4: 50c88d5b14d58f138a3c95d31e3702f01c459e3f

            People

            • Assignee:
              Zentol Chesnay Schepler
              Reporter:
              yuzhihong@gmail.com Ted Yu
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development