Close resources in UUIDFetcher

Resource leak by not closing the InputStreamReader
This commit is contained in:
Felix Bergmann 2020-04-07 09:54:57 +02:00 committed by GitHub
parent 8dc955542d
commit 877ef15374
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -49,7 +49,9 @@ public class UUIDFetcher implements Callable<Map<String, UUID>> {
String body = array.toString();
writeBody(connection, body);
JsonObject[] jsonStreamArray = gson.fromJson(new InputStreamReader(connection.getInputStream()), JsonObject[].class);
InputStreamReader tempStream = new InputStreamReader(connection.getInputStream());
JsonObject[] jsonStreamArray = gson.fromJson(tempStream, JsonObject[].class);
tempStream.close();
for (JsonObject jsonProfile : jsonStreamArray) {
String id = jsonProfile.get("id").getAsString();