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

Tar decompression fails with NullPointerException

    XMLWordPrintableJSON

Details

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

    Description

      This Kotlin code fails with exception(NPE.tar is in the attachments)

      Exception in thread "main" java.lang.NullPointerExceptionException in thread "main" java.lang.NullPointerException at org.apache.commons.compress.archivers.tar.TarArchiveInputStream.getNextTarEntry(TarArchiveInputStream.java:424) at org.apache.commons.compress.archivers.tar.TarArchiveInputStream.getNextEntry(TarArchiveInputStream.java:858) at kotlinx.fuzzer.tests.apache.tar.ApacheTarTestKt.main(ApacheTarTest.kt:79) at kotlinx.fuzzer.tests.apache.tar.ApacheTarTestKt.main(ApacheTarTest.kt)

      import org.apache.commons.compress.archivers.ArchiveStreamFactory
      import org.apache.commons.compress.archivers.tar.TarArchiveEntry
      import java.io.File
      import java.io.FileInputStream
      
      fun main() {
          FileInputStream(File("NPE.tar")).use { fis ->
              ArchiveStreamFactory().createArchiveInputStream("tar", fis).use { ais ->
                  var zae = ais.nextEntry as TarArchiveEntry?
                  while (zae != null) {
                      ais.readAllBytes()
                      zae = ais.nextEntry as TarArchiveEntry?
                  }
              }
          }
      }
      

      Attachments

        1. NPE.tar
          11 kB
          Maksim Zuev

        Activity

          People

            peterlee Peter Lee
            zuevmaxim Maksim Zuev
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: