Skip to content

Commit c0c757f

Browse files
SC-1431 - Fixed a possibly leaked response body.
SC-1431 - Fixed a possibly leaked response body.
2 parents d9abad0 + 9fa93ac commit c0c757f

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

api/src/main/java/org/sonarsource/scanner/api/internal/ServerConnection.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ public void downloadFile(String urlPath, Path toFile) throws IOException {
7575
}
7676
String url = baseUrlWithoutTrailingSlash + urlPath;
7777
logger.debug(format("Download %s to %s", url, toFile.toAbsolutePath().toString()));
78-
ResponseBody responseBody = callUrl(url);
7978

80-
try (InputStream in = responseBody.byteStream()) {
79+
try (ResponseBody responseBody = callUrl(url);
80+
InputStream in = responseBody.byteStream()) {
8181
Files.copy(in, toFile, StandardCopyOption.REPLACE_EXISTING);
8282
} catch (IOException | RuntimeException e) {
8383
Utils.deleteQuietly(toFile);

0 commit comments

Comments
 (0)