https://bz.apache.org/bugzilla/show_bug.cgi?id=68979
Bug ID: 68979
Summary: NullPointerException in XSSFFormulaEvaluator with
reference to missing external workbook
Product: POI
Version: 5.2.3-FINAL
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P2
Component: XSSF
Assignee: [email protected]
Reporter: [email protected]
Target Milestone: ---
Created attachment 39696
--> https://bz.apache.org/bugzilla/attachment.cgi?id=39696&action=edit
Input file for the unit test to reproduce the behaviour
The XSSFFormulaEvaluator may throw a NullPointerException when a cell
references an unknown workbook and the evaluator was explicitly told to ignore
missing workbooks.
I could reproduce the behaviour with versions 5.2.2 (included in jxls 2.14) up
to 5.2.4. With version 4.1.2 (included in jxls 2.12), the evaluator reads the
file without an error and produces a sheet with a single row and a single cell.
This is the behaviour I would still expect with the new version.
Here is a unit-test to reproduce the behaviour with the attached file, which
only contains a single sheet with a single cell:
@Test
void testFileWithFormulaReferenceToNonExistingFile() throws IOException {
InputStream is = new FileInputStream("test.xlsx");
XSSFWorkbook workbook = new XSSFWorkbook(is);
FormulaEvaluator evaluator = new XSSFFormulaEvaluator(workbook);
evaluator.setIgnoreMissingWorkbooks(true);
evaluator.evaluateAll();
Sheet sheet = workbook.getSheetAt(0);
Iterator<Row> rowIt = sheet.rowIterator();
Row row = rowIt.next();
Assertions.assertEquals(1, row.getPhysicalNumberOfCells());
}
The formula is quite complex (with VLOOKUP, extracted from a real failing
example). I did not manage to simplify it without losing the reproducibility of
the problem.
--
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]