You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by bo...@apache.org on 2018/01/09 17:40:57 UTC

[04/28] commons-compress git commit: COMPRESS-380 add testcase for deflat64 support

COMPRESS-380 add testcase for deflat64 support

based on an archive kindly provided by Dawid Weiss


Project: http://git-wip-us.apache.org/repos/asf/commons-compress/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-compress/commit/a62c3d0d
Tree: http://git-wip-us.apache.org/repos/asf/commons-compress/tree/a62c3d0d
Diff: http://git-wip-us.apache.org/repos/asf/commons-compress/diff/a62c3d0d

Branch: refs/heads/master
Commit: a62c3d0d8301c450d5bd0ab1bd9bb3862aac5853
Parents: 2042aa0
Author: Stefan Bodewig <bo...@apache.org>
Authored: Thu Jan 4 09:27:10 2018 +0100
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Thu Jan 4 09:27:10 2018 +0100

----------------------------------------------------------------------
 .gitattributes                                   |   1 +
 .../compress/archivers/zip/ZipFileTest.java      |  18 ++++++++++++++++++
 src/test/resources/COMPRESS-380-input            | Bin 0 -> 3072 bytes
 src/test/resources/COMPRESS-380.zip              | Bin 0 -> 2257 bytes
 4 files changed, 19 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-compress/blob/a62c3d0d/.gitattributes
----------------------------------------------------------------------
diff --git a/.gitattributes b/.gitattributes
index 0fda71d..a02cd59 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -14,3 +14,4 @@ src/test/resources/test3.xml            eol=lf
 src/test/resources/test4.xml            eol=lf
 src/test/resources/test?with?spaces.txt eol=lf
 src/test/resources/test.txt             eol=lf
+src/test/resources/COMPRESS-380-input   binary

http://git-wip-us.apache.org/repos/asf/commons-compress/blob/a62c3d0d/src/test/java/org/apache/commons/compress/archivers/zip/ZipFileTest.java
----------------------------------------------------------------------
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 87a3ded..2903f77 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
@@ -581,6 +581,24 @@ public class ZipFileTest {
         entry.setAlignment(3);
     }
 
+    /**
+     * @see "https://issues.apache.org/jira/browse/COMPRESS-380"
+     */
+    @Test
+    public void readDeflate64CompressedStream() throws Exception {
+        final File input = getFile("COMPRESS-380-input");
+        final File archive = getFile("COMPRESS-380.zip");
+        try (FileInputStream in = new FileInputStream(input);
+             ZipFile zf = new ZipFile(archive)) {
+            byte[] orig = IOUtils.toByteArray(in);
+            ZipArchiveEntry e = zf.getEntry("input2");
+            try (InputStream s = zf.getInputStream(e)) {
+                byte[] fromZip = IOUtils.toByteArray(s);
+                assertArrayEquals(orig, fromZip);
+            }
+        }
+    }
+
     private void assertAllReadMethods(byte[] expected, ZipFile zipFile, ZipArchiveEntry entry) {
         // simple IOUtil read
         try (InputStream stream = zf.getInputStream(entry)) {

http://git-wip-us.apache.org/repos/asf/commons-compress/blob/a62c3d0d/src/test/resources/COMPRESS-380-input
----------------------------------------------------------------------
diff --git a/src/test/resources/COMPRESS-380-input b/src/test/resources/COMPRESS-380-input
new file mode 100644
index 0000000..daf1f56
Binary files /dev/null and b/src/test/resources/COMPRESS-380-input differ

http://git-wip-us.apache.org/repos/asf/commons-compress/blob/a62c3d0d/src/test/resources/COMPRESS-380.zip
----------------------------------------------------------------------
diff --git a/src/test/resources/COMPRESS-380.zip b/src/test/resources/COMPRESS-380.zip
new file mode 100644
index 0000000..d9146be
Binary files /dev/null and b/src/test/resources/COMPRESS-380.zip differ