commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stefan Bodewig (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (COMPRESS-264) ZIP reads correctly with commons-compress 1.6, gives NUL bytes in 1.7
Date Fri, 21 Feb 2014 05:36:19 GMT

    [ https://issues.apache.org/jira/browse/COMPRESS-264?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13907978#comment-13907978
] 

Stefan Bodewig commented on COMPRESS-264:
-----------------------------------------

I can confirm I get the same error myself.

> ZIP reads correctly with commons-compress 1.6, gives NUL bytes in 1.7
> ---------------------------------------------------------------------
>
>                 Key: COMPRESS-264
>                 URL: https://issues.apache.org/jira/browse/COMPRESS-264
>             Project: Commons Compress
>          Issue Type: Bug
>          Components: Archivers
>    Affects Versions: 1.7
>         Environment: Ubuntu precise
>            Reporter: Jonathan Nieder
>            Priority: Minor
>
> When running the code below, commons-compress 1.6 writes:
>  Content of test.txt:
>  data
> By comparison, commons-compress 1.7 writes
>  Content of test.txt:
>  ^@^@^@^@^@
> package com.example.jrn;
> import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
> import org.apache.commons.compress.archivers.zip.ZipArchiveInputStream;
> import java.io.ByteArrayInputStream;
> import java.io.IOException;
> import java.lang.System;
> /**
>  * Hello world!
>  *
>  */
> public class App {
>   public static void main(String[] args) {
>     byte[] zip = {
>        (byte)0x50, (byte)0x4b, (byte)0x03, (byte)0x04, (byte)0x0a, (byte)0x00,
>        (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x03, (byte)0x7b,
>        (byte)0xd1, (byte)0x42, (byte)0x82, (byte)0xc5, (byte)0xc1, (byte)0xe6,
>        (byte)0x05, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x05, (byte)0x00,
>        (byte)0x00, (byte)0x00, (byte)0x08, (byte)0x00, (byte)0x1c, (byte)0x00,
>        (byte)0x74, (byte)0x65, (byte)0x73, (byte)0x74, (byte)0x2e, (byte)0x74,
>        (byte)0x78, (byte)0x74, (byte)0x55, (byte)0x54, (byte)0x09, (byte)0x00,
>        (byte)0x03, (byte)0x56, (byte)0x62, (byte)0xbf, (byte)0x51, (byte)0x2a,
>        (byte)0x63, (byte)0xbf, (byte)0x51, (byte)0x75, (byte)0x78, (byte)0x0b,
>        (byte)0x00, (byte)0x01, (byte)0x04, (byte)0x01, (byte)0xff, (byte)0x01,
>        (byte)0x00, (byte)0x04, (byte)0x88, (byte)0x13, (byte)0x00, (byte)0x00,
>        (byte)0x64, (byte)0x61, (byte)0x74, (byte)0x61, (byte)0x0a, (byte)0x50,
>        (byte)0x4b, (byte)0x01, (byte)0x02, (byte)0x1e, (byte)0x03, (byte)0x0a,
>        (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x03,
>        (byte)0x7b, (byte)0xd1, (byte)0x42, (byte)0x82, (byte)0xc5, (byte)0xc1,
>        (byte)0xe6, (byte)0x05, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x05,
>        (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x08, (byte)0x00, (byte)0x18,
>        (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x01,
>        (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xa0, (byte)0x81, (byte)0x00,
>        (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x74, (byte)0x65, (byte)0x73,
>        (byte)0x74, (byte)0x2e, (byte)0x74, (byte)0x78, (byte)0x74, (byte)0x55,
>        (byte)0x54, (byte)0x05, (byte)0x00, (byte)0x03, (byte)0x56, (byte)0x62,
>        (byte)0xbf, (byte)0x51, (byte)0x75, (byte)0x78, (byte)0x0b, (byte)0x00,
>        (byte)0x01, (byte)0x04, (byte)0x01, (byte)0xff, (byte)0x01, (byte)0x00,
>        (byte)0x04, (byte)0x88, (byte)0x13, (byte)0x00, (byte)0x00, (byte)0x50,
>        (byte)0x4b, (byte)0x05, (byte)0x06, (byte)0x00, (byte)0x00, (byte)0x00,
>        (byte)0x00, (byte)0x01, (byte)0x00, (byte)0x01, (byte)0x00, (byte)0x4e,
>        (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x47, (byte)0x00, (byte)0x00,
>        (byte)0x00, (byte)0x00, (byte)00
>     };
>     ByteArrayInputStream bin = new ByteArrayInputStream(zip);
>     try {
>       ZipArchiveInputStream in = new ZipArchiveInputStream(bin);
>       try {
>         while (true) {
>           ZipArchiveEntry entry = in.getNextZipEntry();
>           if (entry == null) {
>             break;
>           }
>           byte[] buf = new byte[(int) entry.getSize()];
>           in.read(buf);
>           System.out.println("Content of " + entry.getName() + ":");
>           System.out.write(buf);
>         }
>       } finally {
>         in.close();
>       }
>     } catch (IOException e) {
>       System.err.println("IOException: " + e);
>     }
>   }
> }



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Mime
View raw message