diff options
author | Simon Brandhof <simon.brandhof@sonarsource.com> | 2016-11-10 18:29:20 +0100 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@sonarsource.com> | 2016-11-14 12:18:51 +0100 |
commit | 15db2c1a8a66c89692ce4392d5388269e82cee2c (patch) | |
tree | 534c9e88753665cd115e6ad982af5dac75305f04 | |
parent | 976aa63a8ee9bf1df31eb23d5085a67074f0d5e7 (diff) | |
download | sonarqube-15db2c1a8a66c89692ce4392d5388269e82cee2c.tar.gz sonarqube-15db2c1a8a66c89692ce4392d5388269e82cee2c.zip |
SONAR-8351 fix resource leak when sending HTTP request
-rw-r--r-- | server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/webhook/WebhookCallerImpl.java | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/webhook/WebhookCallerImpl.java b/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/webhook/WebhookCallerImpl.java index 60a84bd7330..58fbf1e257c 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/webhook/WebhookCallerImpl.java +++ b/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/webhook/WebhookCallerImpl.java @@ -56,8 +56,7 @@ public class WebhookCallerImpl implements WebhookCaller { .setAt(startedAt) .setPayload(payload) .setWebhook(webhook); - try { - Response response = okHttpClient.newCall(request.build()).execute(); + try (Response response = okHttpClient.newCall(request.build()).execute()) { builder.setHttpStatus(response.code()); builder.setDurationInMs((int)(system.now() - startedAt)); } catch (IOException e) { |