From 877ef153747b28a9cd7dc60917eca03acdbe0572 Mon Sep 17 00:00:00 2001 From: Felix Bergmann Date: Tue, 7 Apr 2020 09:54:57 +0200 Subject: [PATCH] Close resources in UUIDFetcher Resource leak by not closing the InputStreamReader --- src/main/java/com/gmail/nossr50/util/uuid/UUIDFetcher.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/gmail/nossr50/util/uuid/UUIDFetcher.java b/src/main/java/com/gmail/nossr50/util/uuid/UUIDFetcher.java index 995a11513..1da4ddd16 100644 --- a/src/main/java/com/gmail/nossr50/util/uuid/UUIDFetcher.java +++ b/src/main/java/com/gmail/nossr50/util/uuid/UUIDFetcher.java @@ -49,7 +49,9 @@ public class UUIDFetcher implements Callable> { 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();