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

Phil Race prr at openjdk.org
Wed Sep 14 21:35:08 UTC 2022


On Tue, 13 Sep 2022 13:45:46 GMT, Abhishek Kumar <duke at openjdk.org> wrote:

>> JFileChooser - empty file size issue fixed. 
>> For empty file, now the size 0 KB.
>> Manual Test Case "FileSizeCheck.java" created.
>
> Abhishek Kumar has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Review comment fix

Rounding to the nearest 0.1KB (or 0.1Mb ?) doesn't work well if it causes you to round the size down to zero.
If I am understanding the thread correctly, the native chooser ducks this by displaying the exact byte count for < 1,000 - no rounding either up or down. 
So if we wanted to round to nearest for > 1KB we'd need to do the same - correct ?
But we'd decided (due to localization issues) to just always use Kb not byte, or bytes .. 

So leaving aside what the native chooser does, we then just have to be consistent and round up. 

That's what the current version is trying to do isn't it ?

Thoughts ?

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

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



More information about the client-libs-dev mailing list