RFR: 8236987: Remove call to System.out.println from ImageIcon.loadImage

Tejesh R duke at openjdk.java.net
Thu Mar 10 15:33:57 UTC 2022


On Thu, 10 Mar 2022 13:19:22 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:

>> 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.

WaitForID() definition states that "If there is an error while loading or scaling an image, then that image is considered to have finished loading". Does this indicates that no error checking is required.....?

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

PR: https://git.openjdk.java.net/jdk/pull/7754



More information about the client-libs-dev mailing list