[LANG-849] FastDateFormat generates Date objects wastefully.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@1406026 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Gary D. Gregory 2012-11-06 01:58:29 +00:00
parent 641aa249c3
commit 310edf6439
3 changed files with 5 additions and 2 deletions

View File

@ -22,6 +22,7 @@
<body>
<release version="3.2" date="TBA" description="Next release">
<action issue="LANG-849" type="fix">FastDateFormat generates Date objects wastefully</action>
<action issue="LANG-845" type="fix">Spelling fixes</action>
<action issue="LANG-844" type="fix">Fix examples contained in javadoc of StringUtils.center methods</action>
<action issue="LANG-841" type="add">Add StringUtils API to call String.replaceAll in DOTALL a.k.a. single-line mode</action>

View File

@ -395,7 +395,7 @@ public class FastDateFormat extends Format implements DateParser, DatePrinter {
*/
@Override
public String format(long millis) {
return format(new Date(millis));
return printer.format(millis);
}
/**

View File

@ -394,7 +394,9 @@ public class FastDatePrinter implements DatePrinter, Serializable {
*/
@Override
public String format(long millis) {
return format(new Date(millis));
Calendar c = new GregorianCalendar(mTimeZone, mLocale); // hard code GregorianCalendar
c.setTimeInMillis(millis);
return applyRules(c, new StringBuffer(mMaxLengthEstimate)).toString();
}
/* (non-Javadoc)