diff --git a/CHANGELOG.md b/CHANGELOG.md index 16cf14c61..22d6a69e7 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,8 @@ ### 🐞Bug修复 * 【http 】 修复getFileNameFromDisposition不符合规范问题(issue#IAKBPD@Gitee) -* 【crypto 】 修复SymmetricCrypto.setParams和setRandom没有加锁问题(issue#IAJIY3@Github) +* 【crypto 】 修复SymmetricCrypto.setParams和setRandom没有加锁问题(issue#IAJIY3@Gitee) +* 【crypto 】 修复ZipUtil压缩成流的方法检查文件时报错问题(issue#3697@Github) ------------------------------------------------------------------------------------------------------------- # 5.8.31(2024-08-12) diff --git a/hutool-core/src/main/java/cn/hutool/core/compress/ZipWriter.java b/hutool-core/src/main/java/cn/hutool/core/compress/ZipWriter.java index ff724b747..c7aad381d 100755 --- a/hutool-core/src/main/java/cn/hutool/core/compress/ZipWriter.java +++ b/hutool-core/src/main/java/cn/hutool/core/compress/ZipWriter.java @@ -24,6 +24,7 @@ import java.util.zip.ZipOutputStream; * @author looly * @since 5.7.8 */ +@SuppressWarnings("resource") public class ZipWriter implements Closeable { /** @@ -257,7 +258,7 @@ public class ZipWriter implements Closeable { } } else { // issue#IAGYDG 检查加入的文件是否为压缩结果文件本身,避免死循环 - if (FileUtil.equals(file, zipFile)) { + if (null != this.zipFile && FileUtil.equals(file, zipFile)) { return this; }