RFR: 8236987: Remove call to System.out.println from ImageIcon.loadImage
Tejesh R
duke at openjdk.java.net
Mon Mar 21 04:15:34 UTC 2022
On Tue, 15 Mar 2022 16:49:56 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:
>>> @aivanov-jdk , U r right, the status remains LOADING for url...... I was getting "ERRORED" because I was showing a message using `JOptionPane.showMessageDialog(null, "");` before setting ImageIcon.
>>
>> Ah, with the message dialog shown there's enough time to complete loading the image.
>
>> N for current bug, where to change to change the status to "ABORTED"......?? As I cannot change in ImageIcon class......
>
> Why can't you change the status in `ImageIcon`? It's where you change it.
>
>
> loadStatus = mTracker.statusID(id, false);
> mTracker.removeImage(image, id);
> if (loadStatus & MediaTracker.LOADING != 0) {
> loadStatus = MediaTracker.ABORTED;
> }
>
> The first two lines already exist, right after the catching `InterruptedException`. You just need to add the `if` block to amend the status.
How about setting the status to ABORTED only if it is Interrupted.....?
> try {
> mTracker.waitForID(id, 0);
> } catch (InterruptedException e) {
> bIsInterrupted = true;
> }
> if (bIsInterrupted == true)
> {
> loadStatus = MediaTracker.ABORTED;
> }
> else
> {
> loadStatus = mTracker.statusID(id, false);
> }
-------------
PR: https://git.openjdk.java.net/jdk/pull/7754
More information about the client-libs-dev
mailing list