From 0d64bc0adff8bccf5a464b81bc15904f4b61a7ef Mon Sep 17 00:00:00 2001 From: "Lukas Rieger (Blue)" Date: Sun, 29 Sep 2024 22:20:17 +0200 Subject: [PATCH] Fix webapp data-stream not being closed in rare cases --- .../bluemap/common/web/MapStorageRequestHandler.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/src/main/java/de/bluecolored/bluemap/common/web/MapStorageRequestHandler.java b/common/src/main/java/de/bluecolored/bluemap/common/web/MapStorageRequestHandler.java index 94c8ec23..c85c0f5f 100644 --- a/common/src/main/java/de/bluecolored/bluemap/common/web/MapStorageRequestHandler.java +++ b/common/src/main/java/de/bluecolored/bluemap/common/web/MapStorageRequestHandler.java @@ -130,7 +130,7 @@ private void writeToResponse(CompressedInputStream data, HttpResponse response, ) { response.addHeader("Content-Encoding", Compression.GZIP.getId()); ByteArrayOutputStream byteOut = new ByteArrayOutputStream(); - try (OutputStream os = Compression.GZIP.compress(byteOut)) { + try (data; OutputStream os = Compression.GZIP.compress(byteOut)) { data.decompress().transferTo(os); } byte[] compressedData = byteOut.toByteArray();