Bug 57642

Summary: Worksheet setSheetName() fails when IFERROR function is present
Product: POI Reporter: Alessandro Guarascio <guarale>
Component: XSSFAssignee: POI Developers List <dev>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: 3.11-FINAL   
Target Milestone: ---   
Hardware: PC   
OS: All   
Attachments: A proposed patch (not sure it's the right solution!)

Description Alessandro Guarascio 2015-02-27 14:30:15 UTC
Created attachment 32524 [details]
A proposed patch (not sure it's the right solution!)

When an IFERROR() function is present into a cell, renaming worksheet via sheet.setSheetName() leads to a NullPointerException

Here is the stacktrace
java.lang.NullPointerException
	at org.apache.poi.xssf.usermodel.helpers.XSSFFormulaUtils.updatePtg(XSSFFormulaUtils.java:128)
	at org.apache.poi.xssf.usermodel.helpers.XSSFFormulaUtils.updateFormula(XSSFFormulaUtils.java:98)
	at org.apache.poi.xssf.usermodel.helpers.XSSFFormulaUtils.updateSheetName(XSSFFormulaUtils.java:78)
	at org.apache.poi.xssf.usermodel.XSSFWorkbook.setSheetName(XSSFWorkbook.java:1368)

That worked on POI 3.10 release.
Comment 1 Nick Burch 2015-04-24 02:13:45 UTC
This should hopefully be fixed in r1675745, along with a related bug with range sheet references