From 59ee53ca71cc2e97c77f43bb92e6e0c6ed1af4e6 Mon Sep 17 00:00:00 2001 From: PJ Fanning Date: Fri, 19 Oct 2018 07:43:04 +0000 Subject: [PATCH] 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 --- .../xssf/usermodel/BaseXSSFFormulaEvaluator.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) 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); + } } } -- 2.39.5