On Wed, 20 Jul 2022 15:11:47 GMT, Andy Goryachev <[email protected]> wrote:
>> Abhishek Kumar has updated the pull request incrementally with one
>> additional commit since the last revision:
>>
>> File Size shows upto 1 decimal value
>
> src/java.desktop/share/classes/sun/swing/FilePane.java line 1233:
>
>> 1231:
>> 1232: public double formatToDoubleValue(long len) {
>> 1233: DecimalFormat df = new DecimalFormat("0.0");
>
> two comments:
> 1. you can safely return a formatted string instead of another double
> 2. should there be a group separator? i.e. should you get a locale-specific
> NumberFormat instance?
I think as the file size is getting compared so I am returning double value
from the method.
I guess group separator is not required as the file size is calculated in terms
of Base 10. So anything above or equal to 1000 will be converted to next size
unit. For e.g
If filesize is in terms of KB-
999 - "999 KB"
1000 - "1 MB" ...
Even this portion of code is not getting executed in windows as well as in mac
and in ubuntu, there is no group separator.
As it is only doing formatting of a numeric number so I think there won't be
any issues with locale specific.
-------------
PR: https://git.openjdk.org/jdk/pull/9327