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 efad7d4ad Reuse NIO API instead of custom code
efad7d4ad is described below

commit efad7d4ad9461717d59c74c25a0e6c322756d6cc
Author: Gary Gregory <[email protected]>
AuthorDate: Tue Nov 14 13:50:10 2023 -0500

    Reuse NIO API instead of custom code
---
 src/test/java/org/apache/commons/compress/archivers/ZipTest.java | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/test/java/org/apache/commons/compress/archivers/ZipTest.java 
b/src/test/java/org/apache/commons/compress/archivers/ZipTest.java
index 81008c254..cb0d42702 100644
--- a/src/test/java/org/apache/commons/compress/archivers/ZipTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/ZipTest.java
@@ -37,6 +37,7 @@ import java.nio.channels.Channels;
 import java.nio.channels.SeekableByteChannel;
 import java.nio.file.Files;
 import java.nio.file.Path;
+import java.nio.file.Paths;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Enumeration;
@@ -237,10 +238,7 @@ public final class ZipTest extends AbstractTest {
                     continue;
                 }
                 // compare all files one by one
-                final File fileToCompare = new File(entry.getName());
-                try (InputStream inputStreamToCompare = 
Files.newInputStream(fileToCompare.toPath())) {
-                    assertArrayEquals(IOUtils.toByteArray(splitInputStream), 
IOUtils.toByteArray(inputStreamToCompare));
-                }
+                assertArrayEquals(IOUtils.toByteArray(splitInputStream), 
Files.readAllBytes(Paths.get(entry.getName())));
                 filesCount++;
             }
             // and the number of files should equal

Reply via email to