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

Phil Race prr at openjdk.org
Mon Jul 18 19:54:07 UTC 2022


On Fri, 15 Jul 2022 05:20:34 GMT, Abhishek Kumar <duke at openjdk.org> wrote:

>> JFileChooser - empty file size issue fixed. 
>> For empty file, now the size 0 bytes.
>> Manual Test Case "ZeroFileSizeCheck.java" created.
>
> Abhishek Kumar has updated the pull request incrementally with one additional commit since the last revision:
> 
>   properties file reverted back and filesize shown in KB

src/java.desktop/share/classes/sun/swing/FilePane.java line 1207:

> 1205:                     len /= 1024L;
> 1206:                     if (len < 1024L) {
> 1207:                         text = MessageFormat.format(kiloByteString, len);

So ALL of these have an "off by one" issue don't they ?

Here a file that is (for example) 2047 bytes in size will be displayed as "1KB"

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

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



More information about the client-libs-dev mailing list