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

NullPointerException in X5455_ExtendedTimestamp.getLocalFileDataData

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.20
    • 1.21
    • None
    • None

    Description

      The following snippet of code throws an undeclared NullPointerException:

      byte[] bytes = base64.getDecoder().decode("UEsDBAoACQAAAGu0ukYdiHewEwAAAAcAAAADABwAYWFhVVQDAAn5ygAAUEsFBgAAAAAC/////////0IAAAAABQAAUEsBAh4DCgAJAP8ABbS6RgAAAAAAIAAHAAAAAAAAAAAAAAABAABQSwUGAAAAAP///wU="); 
      SeekableInMemoryByteChannel input = new SeekableInMemoryByteChannel(bytes); 
      try { ZipFile file = new ZipFile(input); } catch (IOException ignored) {}
      

      The stack trace is:

      java.lang.NullPointerException: Cannot invoke "org.apache.commons.compress.archivers.zip.ZipLong.getBytes()" because "this.modifyTime" is null
      	at org.apache.commons.compress.archivers.zip.X5455_ExtendedTimestamp.getLocalFileDataData(X5455_ExtendedTimestamp.java:180)
      	at org.apache.commons.compress.archivers.zip.ExtraFieldUtils.mergeLocalFileDataData(ExtraFieldUtils.java:250)
      	at org.apache.commons.compress.archivers.zip.ZipArchiveEntry.setExtra(ZipArchiveEntry.java:691)
      	at org.apache.commons.compress.archivers.zip.ZipArchiveEntry.addExtraField(ZipArchiveEntry.java:573)
      	at org.apache.commons.compress.archivers.zip.ZipArchiveEntry.mergeExtraFields(ZipArchiveEntry.java:903)
      	at org.apache.commons.compress.archivers.zip.ZipArchiveEntry.setExtra(ZipArchiveEntry.java:676)
      	at org.apache.commons.compress.archivers.zip.ZipFile.resolveLocalFileHeaderData(ZipFile.java:1237)
      	at org.apache.commons.compress.archivers.zip.ZipFile.<init>(ZipFile.java:373)
      	at org.apache.commons.compress.archivers.zip.ZipFile.<init>(ZipFile.java:318)
      	at org.apache.commons.compress.archivers.zip.ZipFile.<init>(ZipFile.java:274)
      

      I also attached the input as a ZIP file.

      Attachments

        1. npe.zip
          0.1 kB
          Fabian Meumertzheim

        Activity

          People

            Unassigned Unassigned
            Meumertzheim Fabian Meumertzheim
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: