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 2024/12/08 20:07:32 UTC
(maven-apache-resources) 01/01: Prefer try with resources
This is an automated email from the ASF dual-hosted git repository.
elharo pushed a commit to branch try
in repository https://gitbox.apache.org/repos/asf/maven-apache-resources.git
commit a1156fa0bd8e47c65bd4e4f30ac5b1454dbf6d30
Author: Elliotte Rusty Harold <el...@ibiblio.org>
AuthorDate: Sun Dec 8 15:07:24 2024 -0500
Prefer try with resources
---
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();
- }
}
}