From 5919837386cbc84d208e277b0c1dc7a852200ed1 Mon Sep 17 00:00:00 2001 From: Looly Date: Fri, 20 Jun 2025 10:43:09 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D`ZipUtil`=E4=B8=ADzlib?= =?UTF-8?q?=E5=92=8CunZlib=E8=B0=83=E7=94=A8=E5=90=8E=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E6=9C=AA=E9=87=8A=E6=94=BE=E9=97=AE=E9=A2=98=EF=BC=88issue#397?= =?UTF-8?q?6@Github=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 3 ++- hutool-core/src/main/java/cn/hutool/core/util/ZipUtil.java | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 788e44831..aac1628fd 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ # 🚀Changelog ------------------------------------------------------------------------------------------------------------- -# 5.8.39(2025-06-14) +# 5.8.39(2025-06-20) ### 🐣新特性 * 【ai 】 增加SSE流式返回函数参数callback,增加超时时间配置,豆包、grok新增文生图接口,豆包生成视频支持使用model,新增HutoolAI平台 @@ -21,6 +21,7 @@ * 【core 】 修复`ThreadUtil`中中断异常处理丢失中断信息的问题,解决ConcurrencyTester资源未释放的问题(pr#1358@Gitee) * 【core 】 修复`TEL_400_800`正则规则太窄问题(issue#3967@Github) * 【core 】 修复`ClassUti`isNormalClass判断未排除String问题(issue#3965@Github) +* 【core 】 修复`ZipUtil`中zlib和unZlib调用后资源未释放问题(issue#3976@Github) ------------------------------------------------------------------------------------------------------------- # 5.8.38(2025-05-13) diff --git a/hutool-core/src/main/java/cn/hutool/core/util/ZipUtil.java b/hutool-core/src/main/java/cn/hutool/core/util/ZipUtil.java index 2e0dad053..a3fe4dc9d 100755 --- a/hutool-core/src/main/java/cn/hutool/core/util/ZipUtil.java +++ b/hutool-core/src/main/java/cn/hutool/core/util/ZipUtil.java @@ -926,7 +926,7 @@ public class ZipUtil { */ public static byte[] zlib(InputStream in, int level, int length) { final ByteArrayOutputStream out = new ByteArrayOutputStream(length); - Deflate.of(in, out, false).deflater(level); + Deflate.of(in, out, false).deflater(level).close(); return out.toByteArray(); } @@ -974,7 +974,7 @@ public class ZipUtil { */ public static byte[] unZlib(InputStream in, int length) { final ByteArrayOutputStream out = new ByteArrayOutputStream(length); - Deflate.of(in, out, false).inflater(); + Deflate.of(in, out, false).inflater().close(); return out.toByteArray(); }