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 086f177c Use try-with-resources
086f177c is described below
commit 086f177cda50df7ee522a04332c9457050dee497
Author: Gary Gregory <[email protected]>
AuthorDate: Thu Nov 2 18:47:09 2023 -0400
Use try-with-resources
---
.../apache/commons/compress/archivers/DumpTestCase.java | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git
a/src/test/java/org/apache/commons/compress/archivers/DumpTestCase.java
b/src/test/java/org/apache/commons/compress/archivers/DumpTestCase.java
index 9d13f036..f88cd0b0 100644
--- a/src/test/java/org/apache/commons/compress/archivers/DumpTestCase.java
+++ b/src/test/java/org/apache/commons/compress/archivers/DumpTestCase.java
@@ -33,11 +33,10 @@ import org.junit.jupiter.api.Test;
public final class DumpTestCase extends AbstractTestCase {
private void archiveDetection(final File f) throws Exception {
- try (InputStream is = Files.newInputStream(f.toPath())) {
- assertEquals(DumpArchiveInputStream.class,
- ArchiveStreamFactory.DEFAULT
- .createArchiveInputStream(new
BufferedInputStream(is))
- .getClass());
+ try (InputStream is = Files.newInputStream(f.toPath());
+ ArchiveInputStream<? extends ArchiveEntry> archiveInputStream
= ArchiveStreamFactory.DEFAULT
+ .createArchiveInputStream(new
BufferedInputStream(is))) {
+ assertEquals(DumpArchiveInputStream.class,
archiveInputStream.getClass());
}
}
@@ -47,9 +46,9 @@ public final class DumpTestCase extends AbstractTestCase {
expected.add("lost+found/");
expected.add("test1.xml");
expected.add("test2.xml");
- try (InputStream is = Files.newInputStream(f.toPath())) {
- checkArchiveContent(new DumpArchiveInputStream(is),
- expected);
+ try (InputStream is = Files.newInputStream(f.toPath());
+ DumpArchiveInputStream inputStream = new
DumpArchiveInputStream(is);) {
+ checkArchiveContent(inputStream, expected);
}
}