https://bz.apache.org/bugzilla/show_bug.cgi?id=59199
Bug ID: 59199 Summary: setting null value to date cell leads to NPE Product: POI Version: 3.14-FINAL Hardware: PC Status: NEW Severity: normal Priority: P2 Component: XSSF Assignee: dev@poi.apache.org Reporter: jupp.str...@gmx.de When setting a Date value in a cell and the date is null, a NullPointerException is thrown. Example: private void createRow(Sheet sheet, Person person) { Row row = sheet.createRow(0); Cell cell = row.createCell(0); cell.setCellValue(person.getBirthdate()); ... If person.getBirthdate() is null we get a NPE: java.lang.NullPointerException at java.util.Calendar.setTime(Calendar.java:1770) at org.apache.poi.ss.usermodel.DateUtil.getExcelDate(DateUtil.java:76) at org.apache.poi.xssf.usermodel.XSSFCell.setCellValue(XSSFCell.java:742) My workaround is to check for null and in this case set cell.setCellValue((String) null); However, in my opinion Cell.setCellValue(Date value) should take care of this, just like Cell.setCellValue(String value) -- You are receiving this mail because: You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org For additional commands, e-mail: dev-h...@poi.apache.org