summaryrefslogtreecommitdiff
path: root/src/main/java/com/keuin/kbackupfabric/util/ZipUtil.java
diff options
context:
space:
mode:
authorKeuin <[email protected]>2021-06-12 00:03:20 +0800
committerKeuin <[email protected]>2021-06-12 00:03:20 +0800
commit6e49035889b6dbb2cfe04e216d5436a35cc4a772 (patch)
tree7c04adce1b46aa42c505cf797d03104d8a1baa47 /src/main/java/com/keuin/kbackupfabric/util/ZipUtil.java
parent31c312490487def7bf2417a8a997957b435fcbb9 (diff)
fix a minor object leak in failure
Diffstat (limited to 'src/main/java/com/keuin/kbackupfabric/util/ZipUtil.java')
-rw-r--r--src/main/java/com/keuin/kbackupfabric/util/ZipUtil.java3
1 files changed, 2 insertions, 1 deletions
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;