From 5c9fb98bcfae62fbcc56241e5e24433daaecffea Mon Sep 17 00:00:00 2001 From: PJ Fanning Date: Tue, 17 Oct 2023 10:34:23 +0000 Subject: [PATCH] refactor git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1913056 13f79535-47bb-0310-9956-ffa450edef68 --- .../poi/xssf/usermodel/BaseXSSFFormulaEvaluator.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/BaseXSSFFormulaEvaluator.java b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/BaseXSSFFormulaEvaluator.java index 8f8e00087d..50e241fddb 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/BaseXSSFFormulaEvaluator.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/BaseXSSFFormulaEvaluator.java @@ -61,7 +61,8 @@ public abstract class BaseXSSFFormulaEvaluator extends BaseFormulaEvaluator { try { EvaluationCell evalCell = toEvaluationCell(cell); eval = _bookEvaluator.evaluate(evalCell); - cacheExternalWorkbookCells(evalCell); + if (evalCell instanceof XSSFEvaluationCell) + cacheExternalWorkbookCells((XSSFEvaluationCell) evalCell); } catch (IllegalStateException e) { // enhance IllegalStateException which can be // thrown somewhere deep down the evaluation @@ -103,7 +104,7 @@ public abstract class BaseXSSFFormulaEvaluator extends BaseFormulaEvaluator { * * @param evalCell sourceCell */ - private void cacheExternalWorkbookCells(EvaluationCell evalCell) { + private void cacheExternalWorkbookCells(XSSFEvaluationCell evalCell) { // Ptg[] formulaTokens = getEvaluationWorkbook().getFormulaTokens(evalCell); for (Ptg ptg : formulaTokens) { @@ -112,7 +113,7 @@ public abstract class BaseXSSFFormulaEvaluator extends BaseFormulaEvaluator { if (area3DPxg.getExternalWorkbookNumber() > 0) { EvaluationWorkbook.ExternalSheet externalSheet = getEvaluationWorkbook().getExternalSheet(area3DPxg.getSheetName(), area3DPxg.getLastSheetName(), area3DPxg.getExternalWorkbookNumber()); if (externalSheet != null) { - processEvalCell((XSSFEvaluationCell) evalCell, externalSheet, area3DPxg); + processEvalCell(evalCell, externalSheet, area3DPxg); } } -- 2.39.5