aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@sonarsource.com>2016-11-10 18:29:20 +0100
committerSimon Brandhof <simon.brandhof@sonarsource.com>2016-11-14 12:18:51 +0100
commit15db2c1a8a66c89692ce4392d5388269e82cee2c (patch)
tree534c9e88753665cd115e6ad982af5dac75305f04
parent976aa63a8ee9bf1df31eb23d5085a67074f0d5e7 (diff)
downloadsonarqube-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.java3
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) {