RFR: 8288882: JFileChooser - empty (0 bytes) file is displayed as 1 KB [v22]

Abhishek Kumar duke at openjdk.org
Thu Sep 1 17:37:55 UTC 2022


On Thu, 1 Sep 2022 16:13:41 GMT, Phil Race <prr at openjdk.org> wrote:

>> "formatToDouble" method is taking filesize as a long value in parameter and convert it to one decimal precision value. 
>> The reason for converting to one decimal point is to make it similar to native file system which shows file size in one decimal precision.
>> 
>> can "formatToDouble" method rename to "getOneDecimalPrecisionFileSize" ?
>> 
>> Since we are displaying file size in one decimal precision, files having size from 1 to 199 byte will be 0.1 KB. 
>> 1 to 99 byte file size is handled separately otherwise it will show 0.0 KB.
>> 
>> I will add few test case for 100 to 199 byte file.
>
>> Since we are displaying file size in one decimal precision, files having size from 1 to 199 byte will be 0.1 KB.
> 
> Yes, I see that. My point is it seems wrong.

Can you please suggest me what should I do to handle 1 byte to199 bytes ?

-------------

PR: https://git.openjdk.org/jdk/pull/9327



More information about the client-libs-dev mailing list