I tried to traverse all the sheets in a xlsx file with this: XSSFReader.SheetIterator iter = (XSSFReader.SheetIterator) reader.getSheetsData(); while (iter.hasNext()) { InputStream stream = iter.next(); } When the xlsx file contains a chartsheet, a NullPointerException is thrown. I noticed there is a kindof inconsistence in XSSFReader.SheetIterator. In the constructor of XSSFReader.SheetIterator only WORKSHEETs are added to the sheetMap. But in XSSFReader.SheetIterator.next(), it is like this: public InputStream next() { ctSheet = sheetIterator.next(); String sheetId = ctSheet.getId(); try { // if we have sheetId of ChartSheet, we will get nullpointer exception. PackagePart sheetPkg = sheetMap.get(sheetId); return sheetPkg.getInputStream(); } catch(IOException e) { throw new POIXMLException(e); } }
Created attachment 26185 [details] Patch to fix this issue.
Could you please upload a .xlsx file that triggers the problem? I'd like to get a unit test in for this, and none of the current chart .xlsx files seem to trigger it
Created attachment 26188 [details] File contains worksheet and chartsheet.
.xlsx file is attached. (In reply to comment #2) > Could you please upload a .xlsx file that triggers the problem? I'd like to get > a unit test in for this, and none of the current chart .xlsx files seem to > trigger it
Thanks, fixed in r1025630.