Uploaded image for project: 'Commons Compress'
  1. Commons Compress
  2. COMPRESS-159

ChangeSetPerformer not reliable for ZipArchiveInputStreams

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.2
    • 1.5
    • Changesets
    • None
    • 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

    Description

      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.

      Attachments

        Activity

          People

            Unassigned Unassigned
            jbmchuck Jon Michaelchuck
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: