Bug 60459 - Null pointer exception in ExternSheetNameResolver.prependSheetName method
Summary: Null pointer exception in ExternSheetNameResolver.prependSheetName method
Status: RESOLVED DUPLICATE of bug 60460
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 3.15-FINAL
Hardware: Macintosh Mac OS X 10.1
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-12-09 04:28 UTC by Ricky
Modified: 2016-12-09 16:19 UTC (History)
0 users



Attachments
test file (66.50 KB, application/vnd.ms-excel)
2016-12-09 04:28 UTC, Ricky
Details

Note You need to log in before you can comment on or make changes to this bug.
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 ***