https://bz.apache.org/bugzilla/show_bug.cgi?id=68979
apache-bugzilla-sebast...@kaselo.de changed:
What|Removed |Added
Status|NEEDINFO|NEW
--- Comment #2 from apache-bugzilla-sebast...@kaselo.de ---
Thanks for your quick reply - of course I understand your hesitation concerning
foreign xlsx files.
While digging deeper in it, I just realized that the bug seems to be fixed with
version 5.2.5. The ticket may be closed in my opinion; sorry for bothering you
with an already fixed bug. It might be worth, though, to add the unit test, or
a similar one, to the code base as a regression test.
For the record, in case someone stumbles over the same issue or you want to add
a regression test:
The xlsx file can be easily constructed locally by creating an xlsx file with a
single sheet which contains the string
"=VLOOKUP(A2;'file:///unknown-file.xlsx'#$unknown_sheet.$B$2:$H$1014;6;0)" in
cell A1 (the formular seems weird in this context, but comes from a real
application).
The stack trace with version 5.2.4 is as follows:
java.lang.NullPointerException
at
org.apache.poi.xssf.usermodel.BaseXSSFFormulaEvaluator.cacheExternalWorkbookCells(BaseXSSFFormulaEvaluator.java:119)
at
org.apache.poi.xssf.usermodel.BaseXSSFFormulaEvaluator.evaluateFormulaCellValue(BaseXSSFFormulaEvaluator.java:64)
at
org.apache.poi.ss.formula.BaseFormulaEvaluator.evaluateFormulaCell(BaseFormulaEvaluator.java:184)
at
org.apache.poi.ss.formula.BaseFormulaEvaluator.evaluateAllFormulaCells(BaseFormulaEvaluator.java:277)
at
org.apache.poi.xssf.usermodel.XSSFFormulaEvaluator.evaluateAll(XSSFFormulaEvaluator.java:100)
The exception is thrown because the call to getReferencedWorkbooks() in line
116 returns an empty map, causing externalWorkbook to be null. This was not
checked in the call externalWorkbook.getSheetIndex(area3DPxg.getSheetName()) in
line 119.
The commit "[bug-67778] try to make formula eval involving external workbooks
more robust" (git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1913045
13f79535-47bb-0310-9956-ffa450edef68, git commit ID 236710df, from 2023-10-17),
which is included in version 5.2.5, has introduced a null check on
externalWorkbook, thus avoiding the NullPointerException.
Best regards,
Sebastian
--
You are receiving this mail because:
You are the assignee for the bug.
-
To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org
For additional commands, e-mail: dev-h...@poi.apache.org