aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPJ Fanning <fanningpj@apache.org>2018-10-19 07:43:04 +0000
committerPJ Fanning <fanningpj@apache.org>2018-10-19 07:43:04 +0000
commit59ee53ca71cc2e97c77f43bb92e6e0c6ed1af4e6 (patch)
treed6eb621986c941591b43f9871a4958ad7fb72b6f
parent6b433ae8b34b8c32a0457d74fe3b023222fe7945 (diff)
downloadpoi-59ee53ca71cc2e97c77f43bb92e6e0c6ed1af4e6.tar.gz
poi-59ee53ca71cc2e97c77f43bb92e6e0c6ed1af4e6.zip
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
-rw-r--r--src/ooxml/java/org/apache/poi/xssf/usermodel/BaseXSSFFormulaEvaluator.java13
1 files 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);
+ }
}
}