From: PJ Fanning Date: Fri, 19 Oct 2018 07:43:04 +0000 (+0000) Subject: fix class cast issur recently introduced in BaseXSSFFormulaEvaluator X-Git-Tag: REL_4_0_1~51 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=59ee53ca71cc2e97c77f43bb92e6e0c6ed1af4e6;p=poi.git fix class cast issur recently introduced in BaseXSSFFormulaEvaluator git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1844311 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/BaseXSSFFormulaEvaluator.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/BaseXSSFFormulaEvaluator.java index 0e41e50cb5..bbad20e518 100644 --- a/src/ooxml/java/org/apache/poi/xssf/usermodel/BaseXSSFFormulaEvaluator.java +++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/BaseXSSFFormulaEvaluator.java @@ -73,9 +73,14 @@ public abstract class BaseXSSFFormulaEvaluator extends BaseFormulaEvaluator { } protected void setCellType(Cell cell, CellType cellType) { - EvaluationWorkbook evaluationWorkbook = getEvaluationWorkbook(); - BaseXSSFEvaluationWorkbook xewb = BaseXSSFEvaluationWorkbook.class.isAssignableFrom(evaluationWorkbook.getClass()) ? (BaseXSSFEvaluationWorkbook) evaluationWorkbook : null; - - ((XSSFCell) cell).setCellType(cellType, xewb); + if (cell instanceof XSSFCell) { + EvaluationWorkbook evaluationWorkbook = getEvaluationWorkbook(); + BaseXSSFEvaluationWorkbook xewb = BaseXSSFEvaluationWorkbook.class.isAssignableFrom(evaluationWorkbook.getClass()) ? (BaseXSSFEvaluationWorkbook) evaluationWorkbook : null; + + ((XSSFCell) cell).setCellType(cellType, xewb); + } else { + // could be an SXSSFCell + cell.setCellType(cellType); + } } }