From da29f2311c0ee76c7df381c19ea19a0613f3ca49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sondre=20Eikanger=20Kval=C3=B8?= Date: Tue, 3 Oct 2023 14:41:16 +0200 Subject: [PATCH] Lukke entity --- src/main/java/no/ks/fiks/io/klient/FiksIOUtsendingKlient.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/no/ks/fiks/io/klient/FiksIOUtsendingKlient.java b/src/main/java/no/ks/fiks/io/klient/FiksIOUtsendingKlient.java index 3a1936d..26ff7c1 100644 --- a/src/main/java/no/ks/fiks/io/klient/FiksIOUtsendingKlient.java +++ b/src/main/java/no/ks/fiks/io/klient/FiksIOUtsendingKlient.java @@ -54,7 +54,8 @@ public SendtMeldingApiModel send(@NonNull MeldingSpesifikasjonApiModel metadata, return client.execute(request, response -> { final int responseCode = response.getCode(); log.debug("Response status: {}", responseCode); - try (InputStream content = response.getEntity().getContent() ) { + try (final HttpEntity entity = response.getEntity(); + final InputStream content = entity.getContent()) { if (responseCode >= HttpStatus.SC_BAD_REQUEST) { final var contentAsString = IOUtils.toString(content, StandardCharsets.UTF_8); throw new FiksIOHttpException(String.format("HTTP-feil under sending av melding (%d): %s", responseCode, contentAsString), responseCode, contentAsString);