]> source.dussan.org Git - sonarqube.git/commitdiff
Close properly okhttp connections in ITs
authorJulien HENRY <julien.henry@sonarsource.com>
Fri, 1 Mar 2019 09:39:06 +0000 (10:39 +0100)
committerSonarTech <sonartech@sonarsource.com>
Wed, 6 Mar 2019 10:37:12 +0000 (11:37 +0100)
sonar-ws/src/main/java/org/sonarqube/ws/client/OkHttpResponse.java

index 4b50d8796e5d04919e2e8d5faaa2a563a88dd084..143589d0bd46b0baba215cd32e7ac66bd01c4e9b 100644 (file)
@@ -77,13 +77,10 @@ class OkHttpResponse extends BaseResponse {
    */
   @Override
   public String content() {
-    ResponseBody body = okResponse.body();
-    try {
+    try (ResponseBody body = okResponse.body()) {
       return body.string();
     } catch (IOException e) {
       throw fail(e);
-    } finally {
-      body.close();
     }
   }