[jira] [Created] (COMPRESS-159) ChangeSetPerformer not reliable for ZipArchiveInputStreams

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

[jira] [Created] (COMPRESS-159) ChangeSetPerformer not reliable for ZipArchiveInputStreams

ASF GitHub Bot (Jira)
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
<     public ChangeSetResults perform(ArchiveInputStream in, ArchiveOutputStream out)
>     public ChangeSetResults performZip(ZipFile zf, ArchiveOutputStream out)
<         ArchiveEntry entry = null;
<         while ((entry = in.getNextEntry()) != null) {
>         ArrayList<ZipArchiveEntry> entries = Collections.list(zf.getEntriesInPhysicalOrder());
>         for (ZipArchiveEntry entry : entries) {
<                 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