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

AbstractTestCase.createArchive method appears to use incorrect file size - cut and paste error?

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • None
    • 1.0
    • None
    • None

    Description

      The createArchive() method has the following code:

      ZipArchiveEntry entry = new ZipArchiveEntry("testdata/test1.xml");
      entry.setSize(file1.length());
      out.putArchiveEntry(entry);
      IOUtils.copy(new FileInputStream(file1), out);
      out.closeArchiveEntry();
      
      entry = new ZipArchiveEntry("testdata/test2.xml");
      entry.setSize(file1.length());     // <== should this be file2.length?
      out.putArchiveEntry(entry);
      IOUtils.copy(new FileInputStream(file2), out);
      out.closeArchiveEntry();
      

      This looks a bit odd, as the setSize() parameter does not agree with the copy() parameter.

      Attachments

        1. patch-copypasteerror.txt
          4 kB
          cgrobmeier

        Activity

          People

            Unassigned Unassigned
            sebb Sebb
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: