[
https://issues.apache.org/jira/browse/HADOOP-9252?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Tsz Wo (Nicholas), SZE updated HADOOP-9252:
-------------------------------------------
Attachment: c9252_20130203.patch
Good catch! We have to take care the Long.MIN_VALUE special case. I found
another special cases such as 2^20 - 1 will be converted to "1024.00 K" instead
of "1.00 M" due to rounding up.
c9252_20130203.patch: fixes the special cases and adds more tests.
> StringUtils.limitDecimalTo2(..) is unnecessarily synchronized
> -------------------------------------------------------------
>
> Key: HADOOP-9252
> URL: https://issues.apache.org/jira/browse/HADOOP-9252
> Project: Hadoop Common
> Issue Type: Improvement
> Components: util
> Reporter: Tsz Wo (Nicholas), SZE
> Assignee: Tsz Wo (Nicholas), SZE
> Priority: Minor
> Attachments: c9252_20130127.patch, c9252_20130128.patch,
> c9252_20130203.patch
>
>
> limitDecimalTo2(double) currently uses decimalFormat, which is a static
> field, so that it is synchronized. Synchronization is unnecessary since it
> can simply uses String.format(..).
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira