LANG-1247: FastDatePrinter generates Date objects wastefully

closes #168
This commit is contained in:
Chas Honton 2016-07-05 13:42:48 -07:00
parent 03384395a8
commit caaf97ed88
2 changed files with 7 additions and 2 deletions

View File

@ -46,6 +46,7 @@ The <action> type attribute can be add,update,fix,remove.
<body> <body>
<release version="3.5" date="tba" description="tba"> <release version="3.5" date="tba" description="tba">
<action issue="LANG-1247" type="update" dev="chas" due-to="Benoit Wiart">FastDatePrinter generates extra Date objects</action>
<action issue="LANG-1018" type="fix" dev="pschumacher" due-to="Nick Manley">Fix precision loss on NumberUtils.createNumber(String)</action> <action issue="LANG-1018" type="fix" dev="pschumacher" due-to="Nick Manley">Fix precision loss on NumberUtils.createNumber(String)</action>
<action issue="LANG-1229" type="update" dev="pschumacher" due-to="Ruslan Cheremin">HashCodeBuilder.append(Object,Object) is too big to be inlined, which prevents whole builder to be scalarized</action> <action issue="LANG-1229" type="update" dev="pschumacher" due-to="Ruslan Cheremin">HashCodeBuilder.append(Object,Object) is too big to be inlined, which prevents whole builder to be scalarized</action>
<action issue="LANG-1085" type="add" dev="oheger" due-to="oheger / kinow">Add a circuit breaker implementation</action> <action issue="LANG-1085" type="add" dev="oheger" due-to="oheger / kinow">Add a circuit breaker implementation</action>

View File

@ -486,7 +486,9 @@ public String format(final Calendar calendar) {
*/ */
@Override @Override
public StringBuffer format(final long millis, final StringBuffer buf) { public StringBuffer format(final long millis, final StringBuffer buf) {
return format(new Date(millis), buf); final Calendar c = newCalendar();
c.setTimeInMillis(millis);
return applyRules(c, buf);
} }
/* (non-Javadoc) /* (non-Javadoc)
@ -513,7 +515,9 @@ public StringBuffer format(final Calendar calendar, final StringBuffer buf) {
*/ */
@Override @Override
public <B extends Appendable> B format(final long millis, final B buf) { public <B extends Appendable> B format(final long millis, final B buf) {
return format(new Date(millis), buf); final Calendar c = newCalendar();
c.setTimeInMillis(millis);
return applyRules(c, buf);
} }
/* (non-Javadoc) /* (non-Javadoc)