Bug 60459

Summary: Null pointer exception in ExternSheetNameResolver.prependSheetName method
Product: POI Reporter: Ricky <zhangchaowang>
Component: HSSFAssignee: POI Developers List <dev>
Status: RESOLVED DUPLICATE    
Severity: normal    
Priority: P2    
Version: 3.15-FINAL   
Target Milestone: ---   
Hardware: Macintosh   
OS: Mac OS X 10.1   
Attachments: test file

Description Ricky 2016-12-09 04:28:28 UTC
Created attachment 34510 [details]
test file

I'm parsing Excel file from EUSES data set. When get formula of name 'Database' with range ='file:///HEPPC3/gt$/Teaching/Syn/[physyn.xls]#REF'!$AK$70:$AL$70

It throw null pointer exception:
...
for(Name rangedName : wb.getAllNames())
  if (!rangedName.isFunctionName()) {
    xlWorkbook.addNamedRange(rangedName.getNameName(), rangedName.getRefersToFormula());
}
...


Exception in thread "main" java.lang.NullPointerException
	at org.apache.poi.ss.formula.ptg.ExternSheetNameResolver.prependSheetName(ExternSheetNameResolver.java:40)
	at org.apache.poi.ss.formula.ptg.Area3DPtg.toFormulaString(Area3DPtg.java:104)
	at org.apache.poi.ss.formula.FormulaRenderer.toFormulaString(FormulaRenderer.java:91)
	at org.apache.poi.hssf.model.HSSFFormulaParser.toFormulaString(HSSFFormulaParser.java:119)
	at org.apache.poi.hssf.usermodel.HSSFName.getRefersToFormula(HSSFName.java:204)


Sheetname is null. I guess sheet name is #REF error in Excel. Should it return #REF or the index of sheet?

Attached file is test file to replicate the issues.
Comment 1 Ricky 2016-12-09 16:19:11 UTC
Refresh page causing duplicate defects.

*** This bug has been marked as a duplicate of bug 60460 ***