On Fri, 19 Aug 2022 10:40:14 GMT, Abhishek Kumar <d...@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: > > Updated as per review comment src/java.desktop/share/classes/sun/swing/FilePane.java line 1261: > 1259: > 1260: private static double formatToDoubleValue(long len) { > 1261: return (len / 100L) / 10.0d; First "formatToDouble" isn't really a very good name for this. Perhaps I could provide a better one if I could be sure of what the intent is here but at the very least this method needs comments explaining what it is doing AND why. The first (len / 100L) expression means that (eg) 100 and 199 will both become 1 and the return value of the method is 0.1 So rounding DOWN is happening here, whereas (separately) we round UP for value < 100 .. So anything from 1 byte to 199 bytes will be 0.1 KB ? The test doesn't seem to cover this case. ------------- PR: https://git.openjdk.org/jdk/pull/9327