From 3149ea2511d6abb562a5ac744b3ae1a8484e7ee0 Mon Sep 17 00:00:00 2001 From: Stephen Colebourne Date: Wed, 4 May 2011 10:39:14 +0000 Subject: [PATCH] Change Calendar.getInstance to new GregorianCalendar git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@1099402 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/commons/lang3/time/FastDateFormat.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/apache/commons/lang3/time/FastDateFormat.java b/src/main/java/org/apache/commons/lang3/time/FastDateFormat.java index e8bc9fad8..8de12642b 100644 --- a/src/main/java/org/apache/commons/lang3/time/FastDateFormat.java +++ b/src/main/java/org/apache/commons/lang3/time/FastDateFormat.java @@ -26,6 +26,7 @@ import java.text.ParsePosition; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; +import java.util.GregorianCalendar; import java.util.List; import java.util.Locale; import java.util.TimeZone; @@ -690,13 +691,13 @@ public class FastDateFormat extends Format { } /** - *

Formats a {@code Date} object.

+ *

Formats a {@code Date} object using a {@code GregorianCalendar}.

* * @param date the date to format * @return the formatted string */ public String format(Date date) { - Calendar c = Calendar.getInstance(mTimeZone, mLocale); + Calendar c = new GregorianCalendar(mTimeZone, mLocale); // hard code GregorianCalendar c.setTime(date); return applyRules(c, new StringBuffer(mMaxLengthEstimate)).toString(); } @@ -726,14 +727,14 @@ public class FastDateFormat extends Format { /** *

Formats a {@code Date} object into the - * supplied {@code StringBuffer}.

+ * supplied {@code StringBuffer} using a {@code GregorianCalendar}.

* * @param date the date to format * @param buf the buffer to format into * @return the specified string buffer */ public StringBuffer format(Date date, StringBuffer buf) { - Calendar c = Calendar.getInstance(mTimeZone, mLocale); + Calendar c = new GregorianCalendar(mTimeZone, mLocale); // hard code GregorianCalendar c.setTime(date); return applyRules(c, buf); }