https://issues.apache.org/bugzilla/show_bug.cgi?id=50119

           Summary: NullPointerException is throw in
                    XSSFReader.SheetIterator.next() with a  XLSX contains
                    a chartsheet.
           Product: POI
           Version: 3.7-dev
          Platform: PC
        OS/Version: Windows Server 2003
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSSF
        AssignedTo: [email protected]
        ReportedBy: [email protected]


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);
    }
}

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to