poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r709260 - in /poi/branches/ooxml/src: java/org/apache/poi/ss/usermodel/DataFormatter.java ooxml/interfaces-jdk14/org/apache/poi/ss/usermodel/Cell.java
Date Thu, 30 Oct 2008 21:55:50 GMT
Author: josh
Date: Thu Oct 30 14:55:50 2008
New Revision: 709260

URL: http://svn.apache.org/viewvc?rev=709260&view=rev
Log:
Fixed compilation error introduced in r708982

Modified:
    poi/branches/ooxml/src/java/org/apache/poi/ss/usermodel/DataFormatter.java
    poi/branches/ooxml/src/ooxml/interfaces-jdk14/org/apache/poi/ss/usermodel/Cell.java

Modified: poi/branches/ooxml/src/java/org/apache/poi/ss/usermodel/DataFormatter.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/java/org/apache/poi/ss/usermodel/DataFormatter.java?rev=709260&r1=709259&r2=709260&view=diff
==============================================================================
--- poi/branches/ooxml/src/java/org/apache/poi/ss/usermodel/DataFormatter.java (original)
+++ poi/branches/ooxml/src/java/org/apache/poi/ss/usermodel/DataFormatter.java Thu Oct 30
14:55:50 2008
@@ -63,7 +63,7 @@
  * @author James May (james dot may at fmr dot com)
  *
  */
-public class DataFormatter {
+public final class DataFormatter {
 
     /** Pattern to find a number format: "0" or  "#" */
     private static final Pattern numPattern = Pattern.compile("[0#]+");
@@ -469,28 +469,20 @@
      * @param evaluator The FormulaEvaluator (can be null)
      * @return a string value of the cell
      */
-    public String formatCellValue(Cell cell,
-                                  FormulaEvaluator evaluator) throws IllegalArgumentException
{
+    public String formatCellValue(Cell cell, FormulaEvaluator evaluator) {
 
         if (cell == null) {
             return "";
         }
 
         int cellType = cell.getCellType();
-        if (evaluator != null && cellType == Cell.CELL_TYPE_FORMULA) {
-            try {
-                cellType = evaluator.evaluateFormulaCell(cell);
-            } catch (RuntimeException e) {
-                throw new RuntimeException("Did you forget to set the current" +
-                        " row on the FormulaEvaluator?", e);
+        if (cellType == Cell.CELL_TYPE_FORMULA) {
+            if (evaluator == null) {
+                return cell.getCellFormula();
             }
+            cellType = evaluator.evaluateFormulaCell(cell);
         }
-        switch (cellType)
-        {
-            case Cell.CELL_TYPE_FORMULA :
-                // should only occur if evaluator is null
-                return cell.getCellFormula();
-
+        switch (cellType) {
             case Cell.CELL_TYPE_NUMERIC :
 
                 if (DateUtil.isCellDateFormatted(cell)) {

Modified: poi/branches/ooxml/src/ooxml/interfaces-jdk14/org/apache/poi/ss/usermodel/Cell.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/ooxml/interfaces-jdk14/org/apache/poi/ss/usermodel/Cell.java?rev=709260&r1=709259&r2=709260&view=diff
==============================================================================
--- poi/branches/ooxml/src/ooxml/interfaces-jdk14/org/apache/poi/ss/usermodel/Cell.java (original)
+++ poi/branches/ooxml/src/ooxml/interfaces-jdk14/org/apache/poi/ss/usermodel/Cell.java Thu
Oct 30 14:55:50 2008
@@ -17,6 +17,8 @@
 
 package org.apache.poi.ss.usermodel;
 
+import java.util.Date;
+
 import org.apache.poi.hssf.usermodel.HSSFCellStyle;
 import org.apache.poi.hssf.usermodel.HSSFRichTextString;
 import org.apache.poi.hssf.usermodel.HSSFSheet;
@@ -98,6 +100,11 @@
 
     boolean getBooleanCellValue();
     double getNumericCellValue();
+    /**
+     * get the value of the cell as a date.  For strings we throw an exception.
+     * For blank cells we return a null.
+     */
+    Date getDateCellValue();
     HSSFRichTextString getRichStringCellValue();
 
     void setCellType(int cellType);



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


Mime
View raw message