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 2017/01/10 17:08:43 UTC
commons-compress git commit: COMPRESS-358 add unit test
Repository: commons-compress
Updated Branches:
refs/heads/master a1f969a40 -> 00fcf5462
COMPRESS-358 add unit test
Project: http://git-wip-us.apache.org/repos/asf/commons-compress/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-compress/commit/00fcf546
Tree: http://git-wip-us.apache.org/repos/asf/commons-compress/tree/00fcf546
Diff: http://git-wip-us.apache.org/repos/asf/commons-compress/diff/00fcf546
Branch: refs/heads/master
Commit: 00fcf54625b83ad1499857690157a71f03175673
Parents: a1f969a
Author: Stefan Bodewig <bo...@apache.org>
Authored: Tue Jan 10 18:07:59 2017 +0100
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Tue Jan 10 18:07:59 2017 +0100
----------------------------------------------------------------------
.../FramedSnappyCompressorInputStreamTest.java | 20 +++++++++++++++++++
src/test/resources/COMPRESS-358.iwa | Bin 0 -> 36288 bytes
src/test/resources/COMPRESS-358.uncompressed | Bin 0 -> 219521 bytes
3 files changed, 20 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/00fcf546/src/test/java/org/apache/commons/compress/compressors/snappy/FramedSnappyCompressorInputStreamTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/compressors/snappy/FramedSnappyCompressorInputStreamTest.java b/src/test/java/org/apache/commons/compress/compressors/snappy/FramedSnappyCompressorInputStreamTest.java
index cca9495..0f07041 100644
--- a/src/test/java/org/apache/commons/compress/compressors/snappy/FramedSnappyCompressorInputStreamTest.java
+++ b/src/test/java/org/apache/commons/compress/compressors/snappy/FramedSnappyCompressorInputStreamTest.java
@@ -170,6 +170,26 @@ public final class FramedSnappyCompressorInputStreamTest
}
}
+ /**
+ * @see "https://issues.apache.org/jira/browse/COMPRESS-358"
+ */
+ @Test
+ public void readIWAFileWithBiggerOffset() throws Exception {
+ File o = new File(dir, "COMPRESS-358.raw");
+ try (InputStream is = new FileInputStream(getFile("COMPRESS-358.iwa"));
+ FramedSnappyCompressorInputStream in =
+ new FramedSnappyCompressorInputStream(is, 1<<16, FramedSnappyDialect.IWORK_ARCHIVE);
+ FileOutputStream out = new FileOutputStream(o)) {
+ IOUtils.copy(in, out);
+ }
+ try (FileInputStream a = new FileInputStream(o);
+ FileInputStream e = new FileInputStream(getFile("COMPRESS-358.uncompressed"))) {
+ byte[] expected = IOUtils.toByteArray(e);
+ byte[] actual = IOUtils.toByteArray(a);
+ assertArrayEquals(expected, actual);
+ }
+ }
+
private void testChecksumUnmasking(final long x) {
assertEquals(Long.toHexString(x),
Long.toHexString(FramedSnappyCompressorInputStream
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/00fcf546/src/test/resources/COMPRESS-358.iwa
----------------------------------------------------------------------
diff --git a/src/test/resources/COMPRESS-358.iwa b/src/test/resources/COMPRESS-358.iwa
new file mode 100644
index 0000000..116d79c
Binary files /dev/null and b/src/test/resources/COMPRESS-358.iwa differ
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/00fcf546/src/test/resources/COMPRESS-358.uncompressed
----------------------------------------------------------------------
diff --git a/src/test/resources/COMPRESS-358.uncompressed b/src/test/resources/COMPRESS-358.uncompressed
new file mode 100644
index 0000000..e7cfa34
Binary files /dev/null and b/src/test/resources/COMPRESS-358.uncompressed differ