diff --git a/runelite-client/src/main/java/net/runelite/client/RuntimeConfigLoader.java b/runelite-client/src/main/java/net/runelite/client/RuntimeConfigLoader.java index 30e64a3e6a3..7be20afc805 100644 --- a/runelite-client/src/main/java/net/runelite/client/RuntimeConfigLoader.java +++ b/runelite-client/src/main/java/net/runelite/client/RuntimeConfigLoader.java @@ -118,7 +118,7 @@ public void onFailure(Call call, IOException e) @Override public void onResponse(Call call, Response response) { - try // NOPMD: UseTryWithResources + try (response) { RuntimeConfig config = RuneLiteAPI.GSON.fromJson(response.body().charStream(), RuntimeConfig.class); future.complete(config); @@ -127,10 +127,6 @@ public void onResponse(Call call, Response response) { future.completeExceptionally(ex); } - finally - { - response.close(); - } } }); return future; diff --git a/runelite-client/src/main/java/net/runelite/client/config/ConfigClient.java b/runelite-client/src/main/java/net/runelite/client/config/ConfigClient.java index e1d43830076..162da2e7558 100644 --- a/runelite-client/src/main/java/net/runelite/client/config/ConfigClient.java +++ b/runelite-client/src/main/java/net/runelite/client/config/ConfigClient.java @@ -160,7 +160,7 @@ public void onFailure(Call call, IOException e) @Override public void onResponse(Call call, Response response) { - try // NOPMD: UseTryWithResources + try (response) { if (response.code() != 200) { @@ -188,10 +188,6 @@ public void onResponse(Call call, Response response) { future.completeExceptionally(ex); } - finally - { - response.close(); - } } }); diff --git a/runelite-client/src/main/java/net/runelite/client/hiscore/HiscoreClient.java b/runelite-client/src/main/java/net/runelite/client/hiscore/HiscoreClient.java index 84bfaafbf54..c63dfcaeb56 100644 --- a/runelite-client/src/main/java/net/runelite/client/hiscore/HiscoreClient.java +++ b/runelite-client/src/main/java/net/runelite/client/hiscore/HiscoreClient.java @@ -90,14 +90,10 @@ public void onFailure(Call call, IOException e) @Override public void onResponse(Call call, Response response) throws IOException { - try // NOPMD: UseTryWithResources + try (response) { future.complete(processResponse(username, response)); } - finally - { - response.close(); - } } }); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/discord/DiscordPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/discord/DiscordPlugin.java index 283a20558be..c66c040e44e 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/discord/DiscordPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/discord/DiscordPlugin.java @@ -238,7 +238,7 @@ public void onFailure(Call call, IOException e) @Override public void onResponse(Call call, Response response) throws IOException { - try // NOPMD: UseTryWithResources + try (response) { if (!response.isSuccessful()) { @@ -254,10 +254,6 @@ public void onResponse(Call call, Response response) throws IOException partyService.setPartyMemberAvatar(event.getMemberId(), image); } - finally - { - response.close(); - } } }); } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/wiki/WikiSearchChatboxTextInput.java b/runelite-client/src/main/java/net/runelite/client/plugins/wiki/WikiSearchChatboxTextInput.java index 622e4db98b3..b680c5737c2 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/wiki/WikiSearchChatboxTextInput.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/wiki/WikiSearchChatboxTextInput.java @@ -135,7 +135,7 @@ public void onFailure(Call call, IOException e) public void onResponse(Call call, Response response) throws IOException { String body = response.body().string(); - try // NOPMD: UseTryWithResources + try (response) { JsonArray jar = new JsonParser().parse(body).getAsJsonArray(); List apredictions = gson.fromJson(jar.get(1), new TypeToken>() @@ -159,10 +159,6 @@ public void onResponse(Call call, Response response) throws IOException { log.warn("error parsing wiki response {}", body, e); } - finally - { - response.close(); - } } }); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/xtea/XteaClient.java b/runelite-client/src/main/java/net/runelite/client/plugins/xtea/XteaClient.java index 355d1d8893b..62716752e07 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/xtea/XteaClient.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/xtea/XteaClient.java @@ -85,17 +85,13 @@ public void onFailure(Call call, IOException e) @Override public void onResponse(Call call, Response response) { - try // NOPMD: UseTryWithResources + try (response) { if (!response.isSuccessful()) { log.debug("unsuccessful xtea response"); } } - finally - { - response.close(); - } } }); }