poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n...@apache.org
Subject svn commit: r949226 - in /poi/trunk/src: java/org/apache/poi/ss/usermodel/DateUtil.java testcases/org/apache/poi/hssf/usermodel/TestHSSFDateUtil.java
Date Fri, 28 May 2010 16:47:01 GMT
Author: nick
Date: Fri May 28 16:47:01 2010
New Revision: 949226

URL: http://svn.apache.org/viewvc?rev=949226&view=rev
Log:
Support a couple more crazy formats, as identified in bug #48872, plus test them

Modified:
    poi/trunk/src/java/org/apache/poi/ss/usermodel/DateUtil.java
    poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDateUtil.java

Modified: poi/trunk/src/java/org/apache/poi/ss/usermodel/DateUtil.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/usermodel/DateUtil.java?rev=949226&r1=949225&r2=949226&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ss/usermodel/DateUtil.java (original)
+++ poi/trunk/src/java/org/apache/poi/ss/usermodel/DateUtil.java Fri May 28 16:47:01 2010
@@ -52,7 +52,7 @@ public class DateUtil {
      */
     private static final Pattern date_ptrn1 = Pattern.compile("^\\[\\$\\-.*?\\]");
     private static final Pattern date_ptrn2 = Pattern.compile("^\\[[a-zA-Z]+\\]");
-    private static final Pattern date_ptrn3 = Pattern.compile("^[yYmMdDhHsS\\-/,. :\\\\]+[ampAMP/]*$");
+    private static final Pattern date_ptrn3 = Pattern.compile("^[yYmMdDhHsS\\-/,. :\"\\\\]+0?[ampAMP/]*$");
 
     /**
      * Given a Date, converts it into a double representing its internal Excel representation,

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDateUtil.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDateUtil.java?rev=949226&r1=949225&r2=949226&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDateUtil.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDateUtil.java Fri May 28
16:47:01 2010
@@ -242,8 +242,8 @@ public final class TestHSSFDateUtil exte
                 "dd.mm.yyyy", "dd\\.mm\\.yyyy",
                 "dd\\ mm\\.yyyy AM", "dd\\ mm\\.yyyy pm",
                  "dd\\ mm\\.yyyy\\-dd", "[h]:mm:ss",
-
-                //YK: TODO "mm:ss.0" is a built-in date format which is not recognized by
DateUtil.isInternalDateFormat
+                 "mm/dd/yy", "\"mm\"/\"dd\"/\"yy\"",
+                 "m\\/d\\/yyyy", 
 
                 // These crazy ones are valid
                 "yyyy-mm-dd;@", "yyyy/mm/dd;@",
@@ -269,7 +269,9 @@ public final class TestHSSFDateUtil exte
                 "mm/dd HH:MM", "yy/mmm/dd SS",
                 "mm/dd HH:MM AM", "mm/dd HH:MM am",
                 "mm/dd HH:MM PM", "mm/dd HH:MM pm",
-                "m/d/yy h:mm AM/PM"
+                "m/d/yy h:mm AM/PM",
+                "hh:mm:ss", "hh:mm:ss.0", "mm:ss.0",
+
         };
         for(int i=0; i<formats.length; i++) {
             assertTrue(



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


Mime
View raw message