commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jon Michaelchuck (Created) (JIRA)" <j...@apache.org>
Subject [jira] [Created] (COMPRESS-159) ChangeSetPerformer not reliable for ZipArchiveInputStreams
Date Tue, 27 Sep 2011 18:19:45 GMT
ChangeSetPerformer not reliable for ZipArchiveInputStreams
----------------------------------------------------------

                 Key: COMPRESS-159
                 URL: https://issues.apache.org/jira/browse/COMPRESS-159
             Project: Commons Compress
          Issue Type: Bug
          Components: Changesets
    Affects Versions: 1.2
         Environment: OpenJDK Runtime Environment (IcedTea6 1.8.7) (6b18-1.8.7-4)
OpenJDK 64-Bit Server VM (build 16.0-b13, mixed mode)
Linux 2.6.38-1-amd64 #1 SMP Wed Mar 16 17:38:02 UTC 2011 x86_64 GNU/Linux

            Reporter: Jon Michaelchuck


ChangeSetPerformer's perform function takes an ArchiveInputStream as an argument and thus
frequently runs into issues described under heading 'ZipArchiveInputStream vs ZipFile' at
http://commons.apache.org/compress/zip.html 

Personally for a simple local solution I've added a slightly modified performZip function
taking a ZipFile argument in place of the ArchiveInputStream argument:

diff perform performZip
1c1
<     public ChangeSetResults perform(ArchiveInputStream in, ArchiveOutputStream out)
---
>     public ChangeSetResults performZip(ZipFile zf, ArchiveOutputStream out)
17,18c17,18
<         ArchiveEntry entry = null;
<         while ((entry = in.getNextEntry()) != null) {
---
>         ArrayList<ZipArchiveEntry> entries = Collections.list(zf.getEntriesInPhysicalOrder());
>         for (ZipArchiveEntry entry : entries) {
46c46
<                 copyStream(in, out, entry);
---
>                 copyStream(zf.getInputStream(entry), out, entry);

A permanent fix may require some re-design, the perform(ArchiveInputStream in, ArchiveOutputStream
out) abstraction may be overly general.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message