Commons Compress
  1. Commons Compress
  2. COMPRESS-3

COMPRESS-REDESIGN: Handle JarArchiveInputStream null getNextEntry() gracefully

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Environment:

      N/A

      Description

      When the method JarArchiveInputStream.getNextEntry() is called after the final archive entry was already returned, an Exception is thrown. This is due to the request to the super class ZipArchiveInputStream.getNextEntry() returning null which denotes the archive is at the end. However that null is used to attempt to try to create a new JarArchiveEntry(null) instance. It is here where the exception is thrown. I suggest doing a quick null check then return null if the archive has been fully traversed.

      1. JarTestCase.patch
        1.0 kB
        Tim Pinet
      2. JarArchiveInputStream.patch
        0.6 kB
        Tim Pinet

        Activity

        Tim Pinet created issue -
        Hide
        Tim Pinet added a comment -

        JarArchiveInputStream.patch: recommended fix for JarArchiveInputStream.getNextEntry() to return null instead of throwing an Exception at the end of an archive.

        Show
        Tim Pinet added a comment - JarArchiveInputStream.patch: recommended fix for JarArchiveInputStream.getNextEntry() to return null instead of throwing an Exception at the end of an archive.
        Tim Pinet made changes -
        Field Original Value New Value
        Attachment JarArchiveInputStream.patch [ 12391094 ]
        Hide
        Tim Pinet added a comment -

        JarTestCase.patch: test case to traverse a Jar file to the end of the archive and ensure that no Exception is thrown. Note: this patch contains code from bug SANDBOX-258 which uses a call to ArchiveEntry.isDirectory().

        Show
        Tim Pinet added a comment - JarTestCase.patch: test case to traverse a Jar file to the end of the archive and ensure that no Exception is thrown. Note: this patch contains code from bug SANDBOX-258 which uses a call to ArchiveEntry.isDirectory().
        Tim Pinet made changes -
        Attachment JarTestCase.patch [ 12391095 ]
        Torsten Curdt made changes -
        Assignee Torsten Curdt [ tcurdt ]
        Torsten Curdt made changes -
        Resolution Fixed [ 1 ]
        Status Open [ 1 ] Closed [ 6 ]
        Dennis Lundberg made changes -
        Project Commons Sandbox [ 12310491 ] Commons Compress [ 12310904 ]
        Key SANDBOX-259 COMPRESS-3
        Component/s Compress [ 12311183 ]
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Closed Closed
        101d 18h 19m 1 Torsten Curdt 07/Jan/09 13:49

          People

          • Assignee:
            Torsten Curdt
            Reporter:
            Tim Pinet
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - 10h
              10h
              Remaining:
              Remaining Estimate - 10h
              10h
              Logged:
              Time Spent - Not Specified
              Not Specified

                Development