RFR: 8288882: JFileChooser - empty (0 bytes) file is displayed as 1 KB [v16]
Alexey Ivanov
aivanov at openjdk.org
Wed Aug 10 18:42:01 UTC 2022
On Wed, 10 Aug 2022 18:22:04 GMT, Abhishek Kumar <duke at openjdk.org> wrote:
> > > > If we display the file size with one decimal point precision, then it doesn't hold at all until the file size reaches 1 KB.
> >
> > Is your point ( pun intended) that it looks like we are displaying files to a decimal precision, but in fact are not ?
That's exactly my point.
> > Could we get a summary in a few sentences of the entire current proposal and the justification for it ?
I also asked for the summary. That time it was a bit different:
https://github.com/openjdk/jdk/pull/9327#discussion_r939828467
> There was an issue with plural forms if we show file sizes in terms of bytes. So, it has been discussed that we can show the file size in terms of "1 KB" for files having size >0 and <1000 bytes. To keep file size similar to native file system, JFileChooser displays file sizes with one decimal point precision.
>
> Now, the issue is whether an empty file should be displayed as "0.0 KB" or "0 KB" ? As of now empty files are displayed as "0 KB".
The original issue is that we displayed a zero-sized file as 1 KB. It's stated in the bug subject and in the bug description with more details.
The initial fix was to display it as 0 bytes, which leads to localisation problems, especially if we take into account 1 byte.
Eventually, it was decided to display the size in KB. Thus zero-sized file is displayed as 0 KB, and one-byte-sized file is displayed as 1 KB. This is fine.
Later on, the decimal point was added to mimic native file navigation app in Ubuntu. Now for files larger than 1 KB, the size is shown up to one decimal point. Yet all the files below 1 KB are still displayed as 1 KB. I think it is confusing. If we care to display the size with one decimal point for larger files, why can't we display the size of smaller files with the same precision?
So, 0 bytes is 0.0 KB; > 0 and <= 100 bytes is 0.1 KB, and so on.
Alternatively, drop the decimal altogether.
-------------
PR: https://git.openjdk.org/jdk/pull/9327
More information about the client-libs-dev
mailing list