https://bz.apache.org/bugzilla/show_bug.cgi?id=67579

            Bug ID: 67579
           Summary: POI 5.2.4 is closing the input stream used in the
                    XSSFWorkbook constructor  which explicitly specifies
                    closeStream=false
           Product: POI
           Version: unspecified
          Hardware: PC
                OS: Mac OS X 10.1
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSSF
          Assignee: dev@poi.apache.org
          Reporter: nniesen...@gmail.com
  Target Milestone: ---

Created attachment 39088
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=39088&action=edit
Zip file with 2 POI XSSFWorkbook exports

Version 5.2.4 started closing the InputStream for 'new
XSSFWorkbook(zipInputStream)' which explicitly specifies closeStream=false

MavenCentral artifact:
implementation 'org.apache.poi:poi-ooxml:5.2.4'

Spock test (works with 5.2.3, fails with 5.2.4):

def 'testExportAll'() {
    given:
    InputStream fileInputStream = new
File('src/test/groovy/ExportAll.zip').newInputStream()

    when: 'export all zip unpacked'
    ZipInputStream zipInputStream = new ZipInputStream(fileInputStream)

    then: 'read first file (entry)'
    ZipEntry zipEntry1 = zipInputStream.getNextEntry()
    assert zipEntry1.name == 'testExport1.xlsx'
    Workbook workbook1 = new XSSFWorkbook(zipInputStream)
    assert workbook1.getSheetAt(0).sheetName == 'testExport1'

    and: 'read first file (entry)'
    ZipEntry zipEntry2 = zipInputStream.getNextEntry() // poi-ooxml:5.2.2
throws java.io.IOException: Stream closed

    assert zipEntry2.name == 'testExport2.xlsx'
    Workbook workbook2 = new XSSFWorkbook(zipInputStream)
    assert workbook2.getSheetAt(0).sheetName == 'testExport2'

    and: 'should be no more'
    assert zipInputStream.getNextEntry() == null
}

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org
For additional commands, e-mail: dev-h...@poi.apache.org

Reply via email to