You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2015/05/12 18:35:15 UTC
[Bug 57925] New: NPE on
org.apache.poi.ss.formula.OperationEvaluationContext#createExternSheetRefEvaluator(org.apache.poi.ss.formula.EvaluationWorkbook.ExternalSheet)
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: dev@poi.apache.org
Reporter: timreset@gmail.com
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: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 57925] NPE on
org.apache.poi.ss.formula.OperationEvaluationContext#createExternSheetRefEvaluator(org.apache.poi.ss.formula.EvaluationWorkbook.ExternalSheet)
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=57925
Dominik Stadler <do...@gmx.at> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |NEEDINFO
OS| |All
--- Comment #1 from Dominik Stadler <do...@gmx.at> ---
I tried to reproduce this but couldn't, can you post self-contained sample code
which allows to see how you trigger this exception?
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 57925] NPE on
org.apache.poi.ss.formula.OperationEvaluationContext#createExternSheetRefEvaluator(org.apache.poi.ss.formula.EvaluationWorkbook.ExternalSheet)
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=57925
Dominik Stadler <do...@gmx.at> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|NEEDINFO |RESOLVED
--- Comment #2 from Dominik Stadler <do...@gmx.at> ---
I found the flaw in my unit-test and have now adjusted the code to more
gracefully handle such invalid external references in r1703999.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org