From: Yegor Kozlov Date: Sat, 21 Jul 2012 10:08:07 +0000 (+0000) Subject: Bugzilla 53369 fixed TestCellFormatPart.testDateFormat failing on jdk 1.7 X-Git-Tag: 3.10-beta1~171 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=00831d3c5b3dd286236a545e418a8c3e0bf73964;p=poi.git Bugzilla 53369 fixed TestCellFormatPart.testDateFormat failing on jdk 1.7 git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1364058 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/documentation/content/xdocs/status.xml b/src/documentation/content/xdocs/status.xml index 01c8b08919..092abdbfc6 100644 --- a/src/documentation/content/xdocs/status.xml +++ b/src/documentation/content/xdocs/status.xml @@ -34,6 +34,7 @@ + 53369 - Fixed tests failing on JDK 1.7 53360 - Fixed SXSSF to correctly write text before escaped Unicode control character Change HSMF Types to have full data on ID, Name and Length, rather than just being a simple ID 48469 - Updated case study diff --git a/src/java/org/apache/poi/ss/format/CellDateFormatter.java b/src/java/org/apache/poi/ss/format/CellDateFormatter.java index 33a9118b15..e45fa267df 100644 --- a/src/java/org/apache/poi/ss/format/CellDateFormatter.java +++ b/src/java/org/apache/poi/ss/format/CellDateFormatter.java @@ -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))(?