You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ye...@apache.org on 2012/07/21 12:08:07 UTC

svn commit: r1364058 - in /poi/trunk/src: documentation/content/xdocs/status.xml java/org/apache/poi/ss/format/CellDateFormatter.java

Author: yegor
Date: Sat Jul 21 10:08:07 2012
New Revision: 1364058

URL: http://svn.apache.org/viewvc?rev=1364058&view=rev
Log:
Bugzilla 53369 fixed TestCellFormatPart.testDateFormat failing on jdk 1.7

Modified:
    poi/trunk/src/documentation/content/xdocs/status.xml
    poi/trunk/src/java/org/apache/poi/ss/format/CellDateFormatter.java

Modified: poi/trunk/src/documentation/content/xdocs/status.xml
URL: http://svn.apache.org/viewvc/poi/trunk/src/documentation/content/xdocs/status.xml?rev=1364058&r1=1364057&r2=1364058&view=diff
==============================================================================
--- poi/trunk/src/documentation/content/xdocs/status.xml (original)
+++ poi/trunk/src/documentation/content/xdocs/status.xml Sat Jul 21 10:08:07 2012
@@ -34,6 +34,7 @@
 
     <changes>
         <release version="3.9-beta1" date="2012-??-??">
+          <action dev="poi-developers" type="fix">53369 - Fixed tests failing on JDK 1.7</action>
           <action dev="poi-developers" type="fix">53360 - Fixed SXSSF to correctly write text before escaped Unicode control character</action>
           <action dev="poi-developers" type="add">Change HSMF Types to have full data on ID, Name and Length, rather than just being a simple ID</action>
           <action dev="poi-developers" type="add">48469 - Updated case study</action>

Modified: poi/trunk/src/java/org/apache/poi/ss/format/CellDateFormatter.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/format/CellDateFormatter.java?rev=1364058&r1=1364057&r2=1364058&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ss/format/CellDateFormatter.java (original)
+++ poi/trunk/src/java/org/apache/poi/ss/format/CellDateFormatter.java Sat Jul 21 10:08:07 2012
@@ -150,7 +150,10 @@ public class CellDateFormatter extends C
         StringBuffer descBuf = CellFormatPart.parseFormat(format,
                 CellFormatType.DATE, partHandler);
         partHandler.finish(descBuf);
-        dateFmt = new SimpleDateFormat(descBuf.toString());
+        // tweak the format pattern to pass tests on JDK 1.7,
+        // See https://issues.apache.org/bugzilla/show_bug.cgi?id=53369
+        String ptrn = descBuf.toString().replaceAll("((y)(?!y))(?<!yy)", "yy");
+        dateFmt = new SimpleDateFormat(ptrn, LOCALE);
     }
 
     /** {@inheritDoc} */
@@ -214,4 +217,4 @@ public class CellDateFormatter extends C
     public void simpleValue(StringBuffer toAppendTo, Object value) {
         SIMPLE_DATE.formatValue(toAppendTo, value);
     }
-}
\ No newline at end of file
+}



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