From 94632f71d2b011d048f935b647f816aae3231b33 Mon Sep 17 00:00:00 2001 From: Daniel Hahne Date: Thu, 11 Jul 2024 10:14:23 +0200 Subject: [PATCH] Ensure Resource is Closed --- util/src/main/java/care/smith/fts/util/FhirEncoder.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/util/src/main/java/care/smith/fts/util/FhirEncoder.java b/util/src/main/java/care/smith/fts/util/FhirEncoder.java index 03699f5e..e80c673c 100644 --- a/util/src/main/java/care/smith/fts/util/FhirEncoder.java +++ b/util/src/main/java/care/smith/fts/util/FhirEncoder.java @@ -45,8 +45,8 @@ public DataBuffer encodeValue( MimeType mimeType, Map hints) { DataBuffer dataBuffer = bufferFactory.allocateBuffer(128); - OutputStreamWriter w = new OutputStreamWriter(dataBuffer.asOutputStream()); - try { + + try (OutputStreamWriter w = new OutputStreamWriter(dataBuffer.asOutputStream())) { log.trace("encode {} to {}", valueType, mimeType); fhir.newJsonParser().encodeToWriter(value, w); } catch (IOException e) {