poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 50119] New: NullPointerException is throw in XSSFReader.SheetIterator.next() with a XLSX contains a chartsheet.
Date Wed, 20 Oct 2010 03:37:40 GMT
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: dev@poi.apache.org
        ReportedBy: zjuwufan@gmail.com


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: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


Mime
View raw message