This is an automated email from the ASF dual-hosted git repository. centic9 pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/poi.git
commit 9a4fa876d605684eeb7f744c50183f2934c8a992 Author: Dominik Stadler <[email protected]> AuthorDate: Sat Aug 8 07:30:01 2026 +0200 Free resources in tests --- .../java/org/apache/poi/openxml4j/util/TestZipArchiveFakeEntry.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/poi-ooxml/src/test/java/org/apache/poi/openxml4j/util/TestZipArchiveFakeEntry.java b/poi-ooxml/src/test/java/org/apache/poi/openxml4j/util/TestZipArchiveFakeEntry.java index 366a1d4d19..1a8e41a90e 100644 --- a/poi-ooxml/src/test/java/org/apache/poi/openxml4j/util/TestZipArchiveFakeEntry.java +++ b/poi-ooxml/src/test/java/org/apache/poi/openxml4j/util/TestZipArchiveFakeEntry.java @@ -90,7 +90,9 @@ public class TestZipArchiveFakeEntry { try (ZipArchiveFakeEntry zipArchiveFakeEntry = new ZipArchiveFakeEntry(entry, baos.toInputStream())) { assertEquals(fakeEntryName, zipArchiveFakeEntry.getName()); UnsynchronizedByteArrayOutputStream baos2 = UnsynchronizedByteArrayOutputStream.builder().get(); - assertEquals(data.length, IOUtils.copy(zipArchiveFakeEntry.getInputStream(), baos2)); + try (InputStream stream = zipArchiveFakeEntry.getInputStream()) { + assertEquals(data.length, IOUtils.copy(stream, baos2)); + } assertEquals(fakeValue, baos2.toString(StandardCharsets.UTF_8.name())); assertEquals(data.length, zipArchiveFakeEntry.getSize()); assertEquals(unencryptedTempFileExpected, zipArchiveFakeEntry.isUnencryptedTempFileBacked()); --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
