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

Andy Goryachev duke at openjdk.org
Wed Jun 29 15:31:47 UTC 2022


On Wed, 29 Jun 2022 13:06:21 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.

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

> 1196:                     text = MessageFormat.format(kiloByteString, len + 1);
> 1197:                 } else if (len < 1024L) {
> 1198:                     text = (len == 0L) ? 0 + " bytes" : len + " bytes";

Is this necessary?
0 + " bytes" -->  "0 bytes"

Also, will this code work correctly for non-English locales?

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

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



More information about the client-libs-dev mailing list