Test code below works fine in version 3.11, gives null pointer exception in 3.12: Workbook wb = new SXSSFWorkbook(); Sheet sheet = wb.createSheet( "Test" ); Row row = sheet.createRow( 0 ); row.setHeightInPoints( 16.00f ); Cell cell = row.createCell( 0 ); String str = null; cell.setCellValue( str ); According to the documentation null should be a valid: "value - value to set the cell to. For formulas we'll set the formula string, for String cells we'll set its value. For other types we will change the cell to a string cell and set its value. If value is null then we will change the cell to a Blank cell." After downloading the source for 3.11 and 3.12, the problem is pretty clear, it's now trying to check the length of value without checking if it's null first. 3.11: public void setCellValue(String value) { ensureTypeOrFormulaType(CELL_TYPE_STRING); if(_value.getType()==CELL_TYPE_FORMULA) ((StringFormulaValue)_value).setPreEvaluatedValue(value); else ((PlainStringValue)_value).setValue(value); } 3.12: public void setCellValue(String value) { ensureTypeOrFormulaType(CELL_TYPE_STRING); if(value.length() > SpreadsheetVersion.EXCEL2007.getMaxTextLength()){ throw new IllegalArgumentException("The maximum length of cell contents (text) is 32,767 characters"); } if(_value.getType()==CELL_TYPE_FORMULA) ((StringFormulaValue)_value).setPreEvaluatedValue(value); else ((PlainStringValue)_value).setValue(value); }
Fixed via r1690652, we now allow null-values again and have unit tests for all variants (HSSF, XSSF, SXSSF) which verify that it works.