On Thu, 21 Jul 2022 10:47:38 GMT, Prasanta Sadhukhan <[email protected]> wrote:
> Fix is to check if adding bytes-to-read to number-bytes-already-read will > exceed MAX_INT, then set Progress to max so that ProgressMonitor can close > the tracker https://github.com/openjdk/jdk/blob/master/src/java.desktop/share/classes/javax/swing/ProgressMonitor.java#L265 After applying the fix, I see that the tracker window closes when it reaches the limit, while the progress may be still ongoing for a prolonged period time. It doesn't look right to me. I think we can either change this close condition, either fake progress to `MAX_INT-1` until we actually reach the end. Anyway it seems like a workaround, real solution would be to migrate to long(probably by adding new constructors and methods to keep compatibility). > No regression test is added as it involves using filesize of >2GB. It doesn't have to be a FileInputStream, since ProgressMonitorInputStream accepts InputStream. So we can make a dummy one with no real data backing it. src/java.desktop/share/classes/javax/swing/ProgressMonitorInputStream.java line 160: > 158: monitor.setProgress(monitor.getMaximum()); > 159: } > 160: } Looks like Lines 154-167 duplicates code from lines 129-142. Can we consider to extract it so another method? ------------- PR: https://git.openjdk.org/jdk/pull/9588
