On Thu, 10 Mar 2022 12:59:47 GMT, Prasanta Sadhukhan <[email protected]>
wrote:
>> Removed the println() line from the Interrupted catch block. Since
>> waitForID() Interrupt indicates completion of Image Loading, println as
>> Interrupt handling was not required.
>
> src/java.desktop/share/classes/javax/swing/ImageIcon.java line 331:
>
>> 329: mTracker.waitForID(id, 0);
>> 330: } catch (InterruptedException e) {
>> 331: System.out.println("INTERRUPTED while loading Image");
>
> should be ok. Only question is, should we set the Thread interrupt flag or
> MediaTracker ABORTED flag too here but seems like this file does not check
> for error status after calling loadImage and it's been there for long so it
> might affect existing application using ImageIcon.
That was my concern too. In fact, `InterruptedException` is not in the regular
flow, it indicates a somewhat error condition which isn't actually handled.
If `loadStatus` of the image is not `COMPLETE` or `ERRORED`, we should probably
move it to `ABORTED`.
I don't think we should raise Thread.interrupt flag again.
-------------
PR: https://git.openjdk.java.net/jdk/pull/7754