From 6e49035889b6dbb2cfe04e216d5436a35cc4a772 Mon Sep 17 00:00:00 2001 From: Keuin Date: Sat, 12 Jun 2021 00:03:20 +0800 Subject: fix a minor object leak in failure --- src/main/java/com/keuin/kbackupfabric/util/ZipUtil.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/keuin/kbackupfabric/util/ZipUtil.java b/src/main/java/com/keuin/kbackupfabric/util/ZipUtil.java index c23527f..eea1148 100644 --- a/src/main/java/com/keuin/kbackupfabric/util/ZipUtil.java +++ b/src/main/java/com/keuin/kbackupfabric/util/ZipUtil.java @@ -127,8 +127,9 @@ public final class ZipUtil { ObjectOutputStream oos = new ObjectOutputStream(baos)) { oos.writeObject(backupMetadata); zipOutputStream.write(baos.toByteArray()); + } finally { + zipOutputStream.closeEntry(); } - zipOutputStream.closeEntry(); //如果只是压缩一个文件,则需要截取该文件的父目录 String srcRootDir = srcPath; -- cgit v1.2.3