You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by el...@apache.org on 2026/08/22 12:42:21 UTC

(maven-jarsigner) branch fix/readManifest-leak created (now b78a98a)

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

elharo pushed a change to branch fix/readManifest-leak
in repository https://gitbox.apache.org/repos/asf/maven-jarsigner.git


      at b78a98a  Fix JarFile leak in readManifest() test helper (#100)

This branch includes the following new commits:

     new b78a98a  Fix JarFile leak in readManifest() test helper (#100)

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(maven-jarsigner) 01/01: Fix JarFile leak in readManifest() test helper (#100)

Posted by el...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

elharo pushed a commit to branch fix/readManifest-leak
in repository https://gitbox.apache.org/repos/asf/maven-jarsigner.git

commit b78a98a09346018199c241e9feae18c3420058ce
Author: Elliotte Rusty Harold <el...@ibiblio.org>
AuthorDate: Sat Aug 22 12:42:13 2026 +0000

    Fix JarFile leak in readManifest() test helper (#100)
---
 .../org/apache/maven/shared/jarsigner/JarSignerUtilTest.java   | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/src/test/java/org/apache/maven/shared/jarsigner/JarSignerUtilTest.java b/src/test/java/org/apache/maven/shared/jarsigner/JarSignerUtilTest.java
index 017440a..9b0eebe 100644
--- a/src/test/java/org/apache/maven/shared/jarsigner/JarSignerUtilTest.java
+++ b/src/test/java/org/apache/maven/shared/jarsigner/JarSignerUtilTest.java
@@ -151,13 +151,9 @@ class JarSignerUtilTest extends AbstractJarSignerTest {
     }
 
     private Manifest readManifest(File file) throws IOException {
-        JarFile jarFile = new JarFile(file);
-
-        Manifest manifest = jarFile.getManifest();
-
-        jarFile.close();
-
-        return manifest;
+        try (JarFile jarFile = new JarFile(file)) {
+            return jarFile.getManifest();
+        }
     }
 
     private boolean containsDigest(Manifest manifest) {