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 7c0824b6 Use try-with-resources
7c0824b6 is described below
commit 7c0824b674f59872a84456ecc6157af087dce410
Author: Gary Gregory <[email protected]>
AuthorDate: Fri Nov 3 15:13:40 2023 -0400
Use try-with-resources
---
.../commons/compress/archivers/ArchiveOutputStreamTest.java | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git
a/src/test/java/org/apache/commons/compress/archivers/ArchiveOutputStreamTest.java
b/src/test/java/org/apache/commons/compress/archivers/ArchiveOutputStreamTest.java
index a0d1f040..150fe988 100644
---
a/src/test/java/org/apache/commons/compress/archivers/ArchiveOutputStreamTest.java
+++
b/src/test/java/org/apache/commons/compress/archivers/ArchiveOutputStreamTest.java
@@ -47,11 +47,12 @@ public class ArchiveOutputStreamTest<O extends
ArchiveOutputStream<E>, E extends
final OutputStream out1 = new ByteArrayOutputStream();
final File dummy = getFile("test1.xml"); // need a real file
- final O aos1 = factory.createArchiveOutputStream(archiveType, out1);
- aos1.putArchiveEntry(aos1.createArchiveEntry(dummy, "dummy"));
- Files.copy(dummy.toPath(), aos1);
- aos1.closeArchiveEntry();
- aos1.close(); // omitted finish
+ try (O aos1 = factory.createArchiveOutputStream(archiveType, out1)) {
+ aos1.putArchiveEntry(aos1.createArchiveEntry(dummy, "dummy"));
+ Files.copy(dummy.toPath(), aos1);
+ aos1.closeArchiveEntry();
+ // omitted finish
+ }
// TODO - check if archives ensure that data has been written to the
stream?