https://bz.apache.org/bugzilla/show_bug.cgi?id=60219
--- Comment #4 from IgnacioHR <[email protected]> --- OK, I've dig into the problem of TestBugs#bug45970 and this is what I see. on line 1852 of o.a.p.hssf.usermodel.TestBugs.java there is the following: row.getCell(1).setCellFormula("'[$http://gagravarr.org/FormulaRefs2.xls]Sheet1'!B2"); During setCellFormula operation, the referenced external workbook is not in the LinkTable as you can see in the following stack trace: LinkTable.getExternalSheetIndex(String, String, String) line: 443 InternalWorkbook.getExternalSheetIndex(String, String, String) line: 2012 HSSFEvaluationWorkbook.getSheetExtIx(SheetIdentifier) line: 300 HSSFEvaluationWorkbook.get3DReferencePtg(CellReference, SheetIdentifier) line: 94 FormulaParser.createAreaRefParseNode(SheetIdentifier, FormulaParser$SimpleRangePart, FormulaParser$SimpleRangePart) line: 957 FormulaParser.parseRangeable() line: 568 FormulaParser.parseRangeExpression() line: 311 FormulaParser.parseSimpleFactor() line: 1516 FormulaParser.percentFactor() line: 1474 FormulaParser.powerFactor() line: 1461 FormulaParser.Term() line: 1834 FormulaParser.additiveExpression() line: 1962 FormulaParser.concatExpression() line: 1946 FormulaParser.comparisonExpression() line: 1903 FormulaParser.intersectionExpression() line: 1876 FormulaParser.unionExpression() line: 1856 FormulaParser.parse() line: 2004 FormulaParser.parse(String, FormulaParsingWorkbook, FormulaType, int, int) line: 170 FormulaParser.parse(String, FormulaParsingWorkbook, FormulaType, int) line: 190 HSSFFormulaParser.parse(String, HSSFWorkbook, FormulaType, int) line: 108 HSSFCell.setCellFormula(String) line: 622 TestBugs.bug45970() line: 1852 LinkTable.getExternalSheetIndex(String, String, String) line: 443 returns -1 because and on line 445 of o.a.p.hssf.model.LinkTable.java a RuntimeException is raised. There are three options: 1) Modify LinkTable to automatically add a new external reference to the link table rather that raise an exception (this way looks easy for POI users) 2) Modify test case 45970 to add an external workbook reference before setting the formula 3) Other, such as define a policy for unreferenced external workbooks and either raise an error or create the reference automatically. Going for (2) seems obvious and the simplest way to fix this problem, but makes live more difficult to developers Going for (1) seems possible in a short period of time, but might break existing test cases (I'm not 100% sure about this) Going for (3) seems to be the right position in a long term. But requires more work Any preference? -- 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]
