You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ni...@apache.org on 2015/07/31 23:44:56 UTC

svn commit: r1693656 - /poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFFormulaEvaluator.java

Author: nick
Date: Fri Jul 31 21:44:56 2015
New Revision: 1693656

URL: http://svn.apache.org/r1693656
Log:
More helpful exception on the wrong cell type

Modified:
    poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFFormulaEvaluator.java

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFFormulaEvaluator.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFFormulaEvaluator.java?rev=1693656&r1=1693655&r2=1693656&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFFormulaEvaluator.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFFormulaEvaluator.java Fri Jul 31 21:44:56 2015
@@ -153,7 +153,7 @@ public class XSSFFormulaEvaluator implem
      *  of the old formula.
      * Else if cell does not contain formula, this method leaves
      *  the cell unchanged.
-     * Note that the same instance of HSSFCell is returned to
+     * Note that the same instance of XSSFCell is returned to
      * allow chained calls like:
      * <pre>
      * int evaluatedCellType = evaluator.evaluateInCell(cell).getCellType();
@@ -164,16 +164,16 @@ public class XSSFFormulaEvaluator implem
      * @param cell
      */
     public XSSFCell evaluateInCell(Cell cell) {
-        if (cell == null) {
-            return null;
-        }
-        XSSFCell result = (XSSFCell) cell;
+        doEvaluateInCell(cell);
+        return (XSSFCell)cell;
+    }
+    protected void doEvaluateInCell(Cell cell) {
+        if (cell == null) return;
         if (cell.getCellType() == XSSFCell.CELL_TYPE_FORMULA) {
             CellValue cv = evaluateFormulaCellValue(cell);
             setCellType(cell, cv); // cell will no longer be a formula cell
             setCellValue(cell, cv);
         }
-        return result;
     }
     private static void setCellType(Cell cell, CellValue cv) {
         int cellType = cv.getCellType();



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org