diff options
author | Yegor Kozlov <yegor@apache.org> | 2012-07-21 10:08:07 +0000 |
---|---|---|
committer | Yegor Kozlov <yegor@apache.org> | 2012-07-21 10:08:07 +0000 |
commit | 00831d3c5b3dd286236a545e418a8c3e0bf73964 (patch) | |
tree | 99165c9a25e7c9b982df31cfe61ca74207bd885d /src | |
parent | 681d7bd1b837a4806da7c1eaced8f5729aef1715 (diff) | |
download | poi-00831d3c5b3dd286236a545e418a8c3e0bf73964.tar.gz poi-00831d3c5b3dd286236a545e418a8c3e0bf73964.zip |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/documentation/content/xdocs/status.xml | 1 | ||||
-rw-r--r-- | src/java/org/apache/poi/ss/format/CellDateFormatter.java | 7 |
2 files changed, 6 insertions, 2 deletions
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 @@ <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> 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))(?<!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 +} |