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

elharo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-apache-resources.git


The following commit(s) were added to refs/heads/master by this push:
     new 68ff9be  Prefer try with resources (#24)
68ff9be is described below

commit 68ff9bee40fd153b5ba4158cf1f0cd28136c316f
Author: Elliotte Rusty Harold <elh...@users.noreply.github.com>
AuthorDate: Sun Dec 8 21:56:20 2024 +0000

    Prefer try with resources (#24)
---
 source-release/src/test/java/org/apache/its/util/TestUtils.java | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/source-release/src/test/java/org/apache/its/util/TestUtils.java 
b/source-release/src/test/java/org/apache/its/util/TestUtils.java
index a388913..a8bcfb6 100644
--- a/source-release/src/test/java/org/apache/its/util/TestUtils.java
+++ b/source-release/src/test/java/org/apache/its/util/TestUtils.java
@@ -95,20 +95,13 @@ public class TestUtils {
             throws ZipException, IOException {
         assertTrue("Assembly archive missing: " + assembly, assembly.isFile());
 
-        ZipFile zf = null;
-        try {
-            zf = new ZipFile(assembly);
-
+        try (ZipFile zf = new ZipFile(assembly)) {
             LinkedHashSet<String> pathSet = new LinkedHashSet<>();
 
             for (Enumeration<? extends ZipEntry> enumeration = zf.entries(); 
enumeration.hasMoreElements(); ) {
                 pathSet.add(enumeration.nextElement().getName());
             }
             assertArchiveContents(required, banned, 
assembly.getAbsolutePath(), pathSet);
-        } finally {
-            if (zf != null) {
-                zf.close();
-            }
         }
     }
 

Reply via email to