Skip to content

Commit

Permalink
Fix resource leak when fetching hotspot data from server
Browse files Browse the repository at this point in the history
  • Loading branch information
jblievremont committed Feb 1, 2021
1 parent 62bb4c0 commit ea3abcf
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ public SecurityHotspotsService(SonarLintWsClient client, Parser<Hotspots.ShowWsR
}

public Optional<RemoteHotspot> fetch(GetSecurityHotspotRequestParams params) {
try {
WsResponse wsResponse = client.get(getUrl(params.hotspotKey, params.projectKey));
try(WsResponse wsResponse = client.get(getUrl(params.hotspotKey, params.projectKey))) {
Hotspots.ShowWsResponse response = parser.parseFrom(wsResponse.contentStream());
return Optional.of(adapt(response));
} catch (Exception e) {
Expand Down

0 comments on commit ea3abcf

Please sign in to comment.