This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-compress.git
The following commit(s) were added to refs/heads/master by this push: new ff1a9a7db Use try-with-resources ff1a9a7db is described below commit ff1a9a7db7348746740de9165f0c5c8b512fe542 Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Fri May 17 10:19:01 2024 -0400 Use try-with-resources --- .../org/apache/commons/compress/archivers/zip/ZipFileTest.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/test/java/org/apache/commons/compress/archivers/zip/ZipFileTest.java b/src/test/java/org/apache/commons/compress/archivers/zip/ZipFileTest.java index cdf81f892..541f51da9 100644 --- a/src/test/java/org/apache/commons/compress/archivers/zip/ZipFileTest.java +++ b/src/test/java/org/apache/commons/compress/archivers/zip/ZipFileTest.java @@ -975,13 +975,13 @@ public class ZipFileTest extends AbstractTest { zos.closeArchiveEntry(); } } - try (ZipFile zipFile = ZipFile.builder().setPath(path).get()) { final ZipArchiveEntry entry = zipFile.getEntry("file-1.txt"); assertEquals("file-1.txt", entry.getName()); - final byte[] content = IOUtils.toByteArray(zipFile.getInputStream(entry)); - assertArrayEquals("entry-content\n".getBytes(StandardCharsets.UTF_8), content); - } + try (InputStream inputStream = zipFile.getInputStream(entry)) { + final byte[] content = IOUtils.toByteArray(inputStream); + assertArrayEquals("entry-content\n".getBytes(StandardCharsets.UTF_8), content); + }} }