From 258a99479f35ffce5bd3e0942197018ba1a14eac Mon Sep 17 00:00:00 2001 From: kb1000 Date: Sat, 20 Jul 2024 02:57:02 +0200 Subject: [PATCH] Add try-with-resources to ErrorManager HttpClient --- .../src/main/java/com/parzivail/errorman/ErrorManager.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/projects/pswg/src/main/java/com/parzivail/errorman/ErrorManager.java b/projects/pswg/src/main/java/com/parzivail/errorman/ErrorManager.java index 800fc3a65..ebb936723 100644 --- a/projects/pswg/src/main/java/com/parzivail/errorman/ErrorManager.java +++ b/projects/pswg/src/main/java/com/parzivail/errorman/ErrorManager.java @@ -197,10 +197,8 @@ private static void dispatchError(CrashReport report) LOG.warn("Posting error to Rollbar"); - try + try (var httpclient = HttpClient.newBuilder().connectTimeout(Duration.ofMinutes(1)).build()) { - var httpclient = HttpClient.newBuilder().connectTimeout(Duration.ofMinutes(1)).build(); - LOG.warn("Executing request to Rollbar"); var response = httpclient.send(HttpRequest.newBuilder()