https://bz.apache.org/bugzilla/show_bug.cgi?id=57925
Bug ID: 57925
Summary: NPE on
org.apache.poi.ss.formula.OperationEvaluationContext#c
reateExternSheetRefEvaluator(org.apache.poi.ss.formula
.EvaluationWorkbook.ExternalSheet)
Product: POI
Version: 3.12-FINAL
Hardware: All
Status: NEW
Severity: normal
Priority: P2
Component: SS Common
Assignee: [email protected]
Reporter: [email protected]
Created attachment 32733
--> https://bz.apache.org/bugzilla/attachment.cgi?id=32733&action=edit
NPE-example file
I tried parse xls file with incorrect formula (incorrect link to cell) and give
NPE:
<pre>
Caused by: java.lang.NullPointerException
at
org.apache.poi.ss.formula.OperationEvaluationContext.createExternSheetRefEvaluator(OperationEvaluationContext.java:97)
at
org.apache.poi.ss.formula.OperationEvaluationContext.createExternSheetRefEvaluator(OperationEvaluationContext.java:88)
at
org.apache.poi.ss.formula.OperationEvaluationContext.getRef3DEval(OperationEvaluationContext.java:305)
at
org.apache.poi.ss.formula.WorkbookEvaluator.getEvalForPtg(WorkbookEvaluator.java:631)
at
org.apache.poi.ss.formula.WorkbookEvaluator.evaluateNameFormula(WorkbookEvaluator.java:690)
at
org.apache.poi.ss.formula.WorkbookEvaluator.getEvalForNameRecord(WorkbookEvaluator.java:679)
at
org.apache.poi.ss.formula.WorkbookEvaluator.getEvalForPtg(WorkbookEvaluator.java:597)
at
org.apache.poi.ss.formula.WorkbookEvaluator.evaluateFormula(WorkbookEvaluator.java:505)
at
org.apache.poi.ss.formula.WorkbookEvaluator.evaluateAny(WorkbookEvaluator.java:263)
at
org.apache.poi.ss.formula.WorkbookEvaluator.evaluate(WorkbookEvaluator.java:205)
at
org.apache.poi.hssf.usermodel.HSSFFormulaEvaluator.evaluateFormulaCellValue(HSSFFormulaEvaluator.java:374)
at
org.apache.poi.hssf.usermodel.HSSFFormulaEvaluator.evaluateFormulaCell(HSSFFormulaEvaluator.java:234)
at
org.apache.poi.ss.usermodel.DataFormatter.formatCellValue(DataFormatter.java:816)
at
com.ptnl.acube.server.excel.WorkbookProcessor.getCellValue(WorkbookProcessor.java:233)
</pre>
It's mistake on code:
<pre>
SheetRangeEvaluator createExternSheetRefEvaluator(ExternalSheet externalSheet)
{
WorkbookEvaluator targetEvaluator;
int otherFirstSheetIndex;
int otherLastSheetIndex = -1;
if (externalSheet == null || externalSheet.getWorkbookName() == null) {
// sheet is in same workbook
targetEvaluator = _bookEvaluator;
otherFirstSheetIndex =
_workbook.getSheetIndex(externalSheet.getSheetName()); //<-- row 97, mistake
there
if (externalSheet instanceof ExternalSheetRange) {
String lastSheetName =
((ExternalSheetRange)externalSheet).getLastSheetName();
otherLastSheetIndex = _workbook.getSheetIndex(lastSheetName);
}
</pre>
If externalSheet == null then tried call method getSheetName() on externalSheet
and give exception.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]