]> source.dussan.org Git - poi.git/commitdiff
fix class cast issur recently introduced in BaseXSSFFormulaEvaluator
authorPJ Fanning <fanningpj@apache.org>
Fri, 19 Oct 2018 07:43:04 +0000 (07:43 +0000)
committerPJ Fanning <fanningpj@apache.org>
Fri, 19 Oct 2018 07:43:04 +0000 (07:43 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1844311 13f79535-47bb-0310-9956-ffa450edef68

src/ooxml/java/org/apache/poi/xssf/usermodel/BaseXSSFFormulaEvaluator.java

index 0e41e50cb5c6de6724333261a1f3d3de56c1e162..bbad20e518a4dd6d1ddd3d242c342b7e3527b419 100644 (file)
@@ -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);
+        }
     }
 }