You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by kw...@apache.org on 2023/11/07 17:41:00 UTC

(jackrabbit-filevault) branch master updated: JCRVLT-728 fix file leak by always closing the intermediate (#322)

This is an automated email from the ASF dual-hosted git repository.

kwin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jackrabbit-filevault.git


The following commit(s) were added to refs/heads/master by this push:
     new 746dddf5 JCRVLT-728 fix file leak by always closing the intermediate (#322)
746dddf5 is described below

commit 746dddf512f68ac66e8b2dd4abfb516c017fee2b
Author: Konrad Windszus <kw...@apache.org>
AuthorDate: Tue Nov 7 18:40:54 2023 +0100

    JCRVLT-728 fix file leak by always closing the intermediate (#322)
    
    ZipVaultPackage
---
 .../vault/packaging/registry/impl/JcrPackageRegistry.java     | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/vault-core/src/main/java/org/apache/jackrabbit/vault/packaging/registry/impl/JcrPackageRegistry.java b/vault-core/src/main/java/org/apache/jackrabbit/vault/packaging/registry/impl/JcrPackageRegistry.java
index deea8a25..24437c67 100644
--- a/vault-core/src/main/java/org/apache/jackrabbit/vault/packaging/registry/impl/JcrPackageRegistry.java
+++ b/vault-core/src/main/java/org/apache/jackrabbit/vault/packaging/registry/impl/JcrPackageRegistry.java
@@ -363,11 +363,12 @@ public class JcrPackageRegistry extends AbstractPackageRegistry {
     @NotNull
     @Override
     public PackageId register(@NotNull File file, boolean replace) throws IOException, PackageExistsException {
-        ZipVaultPackage pack = new ZipVaultPackage(file, false, true);
-        try (JcrPackage pkg = upload(pack, replace)) {
-            return pkg.getPackage().getId();
-        } catch (RepositoryException e) {
-            throw new IOException(e);
+        try (ZipVaultPackage pack = new ZipVaultPackage(file, false, true)) {
+            try (JcrPackage pkg = upload(pack, replace)) {
+                return pkg.getPackage().getId();
+            } catch (RepositoryException e) {
+                throw new IOException(e);
+            }
         }
     }