]> source.dussan.org Git - poi.git/commitdiff
Bugzilla 53369 fixed TestCellFormatPart.testDateFormat failing on jdk 1.7
authorYegor Kozlov <yegor@apache.org>
Sat, 21 Jul 2012 10:08:07 +0000 (10:08 +0000)
committerYegor Kozlov <yegor@apache.org>
Sat, 21 Jul 2012 10:08:07 +0000 (10:08 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1364058 13f79535-47bb-0310-9956-ffa450edef68

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

index 01c8b089191e29e1f781ea87bf6dda199ac78def..092abdbfc6948a93d9ce6aa1f91230f1267c2c99 100644 (file)
@@ -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>
index 33a9118b159c9499dcf13bd2b65e636258afbe59..e45fa267df5c63923e666989a2663f9590e1f870 100644 (file)
@@ -150,7 +150,10 @@ public class CellDateFormatter extends CellFormatter {
         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 CellFormatter {
     public void simpleValue(StringBuffer toAppendTo, Object value) {
         SIMPLE_DATE.formatValue(toAppendTo, value);
     }
-}
\ No newline at end of file
+}