parent
1d1883f0e2
commit
bd9adbb637
|
@ -46,7 +46,8 @@ 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-1248" type="fix" dev="chas" due-to="Benoit Wiart">FastDatePrinter Memory allocation regression</action>
|
||||||
|
<action issue="LANG-1247" type="fix" 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>
|
||||||
|
|
|
@ -684,23 +684,68 @@ public class FastDatePrinter implements DatePrinter, Serializable {
|
||||||
* @param value the value to append digits from.
|
* @param value the value to append digits from.
|
||||||
*/
|
*/
|
||||||
private static void appendFullDigits(final Appendable buffer, int value, int minFieldWidth) throws IOException {
|
private static void appendFullDigits(final Appendable buffer, int value, int minFieldWidth) throws IOException {
|
||||||
// build up decimal representation in reverse
|
// specialized paths for 1 to 4 digits -> avoid the memory allocation from the temporary work array
|
||||||
char[] work = new char[MAX_DIGITS];
|
// see LANG-1248
|
||||||
int digit = 0;
|
if (value < 10000) {
|
||||||
while(value!=0) {
|
// less memory allocation path works for four digits or less
|
||||||
work[digit++] = (char)(value % 10 + '0');
|
|
||||||
value = value / 10;
|
|
||||||
}
|
|
||||||
|
|
||||||
// pad with zeros
|
int nDigits = 4;
|
||||||
while(digit<minFieldWidth) {
|
if (value < 1000) {
|
||||||
buffer.append('0');
|
--nDigits;
|
||||||
--minFieldWidth;
|
if (value < 100) {
|
||||||
}
|
--nDigits;
|
||||||
|
if (value < 10) {
|
||||||
|
--nDigits;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// left zero pad
|
||||||
|
for (int i = minFieldWidth - nDigits; i > 0; --i) {
|
||||||
|
buffer.append('0');
|
||||||
|
}
|
||||||
|
|
||||||
// reverse
|
switch (nDigits) {
|
||||||
while(--digit>=0) {
|
case 4:
|
||||||
buffer.append(work[digit]);
|
buffer.append((char) (value / 1000 + '0'));
|
||||||
|
value %= 1000;
|
||||||
|
case 3:
|
||||||
|
if (value >= 100) {
|
||||||
|
buffer.append((char) (value / 100 + '0'));
|
||||||
|
value %= 100;
|
||||||
|
} else {
|
||||||
|
buffer.append('0');
|
||||||
|
}
|
||||||
|
case 2:
|
||||||
|
if (value >= 10) {
|
||||||
|
buffer.append((char) (value / 10 + '0'));
|
||||||
|
value %= 10;
|
||||||
|
} else {
|
||||||
|
buffer.append('0');
|
||||||
|
}
|
||||||
|
case 1:
|
||||||
|
buffer.append((char) (value + '0'));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// more memory allocation path works for any digits
|
||||||
|
|
||||||
|
// build up decimal representation in reverse
|
||||||
|
char[] work = new char[MAX_DIGITS];
|
||||||
|
int digit = 0;
|
||||||
|
while (value != 0) {
|
||||||
|
work[digit++] = (char) (value % 10 + '0');
|
||||||
|
value = value / 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
// pad with zeros
|
||||||
|
while (digit < minFieldWidth) {
|
||||||
|
buffer.append('0');
|
||||||
|
--minFieldWidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
// reverse
|
||||||
|
while (--digit >= 0) {
|
||||||
|
buffer.append(work[digit]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue