Bug 64420 - NullPointerException in XSSFReader.SheetIterator.next() if XLSX contains a macrosheet
Summary: NullPointerException in XSSFReader.SheetIterator.next() if XLSX contains a ma...
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: XSSF (show other bugs)
Version: 4.1.2-FINAL
Hardware: PC All
: P2 major (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on: 50119
Blocks:
  Show dependency tree
 
Reported: 2020-05-11 13:23 UTC by spfaffer
Modified: 2020-05-16 13:06 UTC (History)
0 users



Attachments
xlsm file containing a macrosheet that reproduces the problem (9.83 KB, application/vnd.ms-excel.sheet.macroEnabled.12)
2020-05-11 13:23 UTC, spfaffer
Details

Note You need to log in before you can comment on or make changes to this bug.
Description spfaffer 2020-05-11 13:23:03 UTC
Created attachment 37224 [details]
xlsm file containing a macrosheet that reproduces the problem

This is almost a duplicate of the fixed bug 50119 except that my xlsm contains a macro sheet. The same analysis as in 50119 applies here.

In the constructor of XSSFReader.SheetIterator only worksheets and chartsheets are added to the sheetMap. The macro sheet (http://schemas.microsoft.com/office/2006/relationships/xlMacrosheet) is not added to the sheetMap. But the iterator iterates over all valid IDs, including the macro sheet. Since the sheetMap doesn't contain the macro sheet this call in SheetIterator.next()

           return sheetPkg.getInputStream();

(org.apache.poi.xssf.eventusermodel.XSSFReader.SheetIterator, line 313)   

throws a NullPointer.
Comment 1 Dominik Stadler 2020-05-16 13:06:39 UTC
Fixed via r1877814 on trunk now.