Bug 51474 - Nullpointer writing empty (null) value
Summary: Nullpointer writing empty (null) value
Alias: None
Product: POI
Classification: Unclassified
Component: SXSSF (show other bugs)
Version: 3.8-dev
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
Depends on:
Reported: 2011-07-05 09:53 UTC by daniel.wehrle
Modified: 2011-07-05 13:42 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description daniel.wehrle 2011-07-05 09:53:06 UTC

i get an NPE writing a null value

String value = null;

Workbook workbook = new SXSSFWorkbook();
Sheet sheet = workbook.createSheet();
Row row = sheet.createRow( currentRowNr);
Cell cell = currentRow.createCell( currentCellNr);

cell.setCellValue( new XSSFRichTextString( value));


	at org.apache.poi.xssf.streaming.SXSSFSheet$SheetDataWriter.outputQuotedString(SXSSFSheet.java:1384)
	at org.apache.poi.xssf.streaming.SXSSFSheet$SheetDataWriter.writeCell(SXSSFSheet.java:1349)
	at org.apache.poi.xssf.streaming.SXSSFSheet$SheetDataWriter.writeRow(SXSSFSheet.java:1289)
	at org.apache.poi.xssf.streaming.SXSSFSheet.flushOneRow(SXSSFSheet.java:1209)
	at org.apache.poi.xssf.streaming.SXSSFSheet.flushRows(SXSSFSheet.java:1199)
	at org.apache.poi.xssf.streaming.SXSSFSheet.getWorksheetXMLInputStream(SXSSFSheet.java:61)
	at org.apache.poi.xssf.streaming.SXSSFWorkbook.injectData(SXSSFWorkbook.java:108)
	at org.apache.poi.xssf.streaming.SXSSFWorkbook.write(SXSSFWorkbook.java:496)

Kind regards,
Comment 1 Nick Burch 2011-07-05 13:12:16 UTC
Not sure what we should be doing for someone giving XSSFRichTextString a null value? 

Any chance you could check what XSSF and HSSF make of this?
Comment 2 daniel.wehrle 2011-07-05 13:28:03 UTC
in XSSF and HSSF it's ok. 

I have changed implementation today cause we need large file export.
Comment 3 Nick Burch 2011-07-05 13:31:14 UTC
Do they just treat it as an empty string?

(We'll want to replicate the same behaviour for SXSSF when fixed)
Comment 4 daniel.wehrle 2011-07-05 13:35:59 UTC
Yes. Null value should be treat as empty string.

I have done a workaround in my implementation. null value -> empty string
Comment 5 Nick Burch 2011-07-05 13:42:19 UTC
Should be fixed in r1143059.