From 00831d3c5b3dd286236a545e418a8c3e0bf73964 Mon Sep 17 00:00:00 2001 From: Yegor Kozlov Date: Sat, 21 Jul 2012 10:08:07 +0000 Subject: [PATCH] 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 --- src/documentation/content/xdocs/status.xml | 1 + 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 @@ + 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))(?