On Fri, 29 Sep 2023 12:41:10 GMT, Alexey Ivanov <aiva...@openjdk.org> wrote:

>> ScientificWare has updated the pull request incrementally with one 
>> additional commit since the last revision:
>> 
>>   Update src/java.desktop/share/classes/javax/swing/text/html/FormView.java
>>   
>>   FormView.java : Remove a redundant space.
>>   
>>   Co-authored-by: Andrey Turbanov <turban...@gmail.com>
>
> src/java.desktop/share/classes/javax/swing/text/html/FormView.java line 285:
> 
>> 283:                 button = icon.getImageLoadStatus() == 
>> MediaTracker.COMPLETE ? new JButton(icon) : new JButton(altAtt);
>> 284:             } catch (MalformedURLException e) {
>> 285:                 button = new JButton(srcAtt);
> 
> Suggestion:
> 
>                 button = new JButton(altAtt);
> 
> If `altAtt` is provided, it should be used to handle invalid `srcAtt` too.

> @aivanov-jdk My apologies, I forgot to reply. I wanted to distinguish the two 
> cases : (Missing resource or bad resource name) and malformed URL. Like in 
> the previous example I gave.

What purpose does this distinction serve?

It could give an additional insight to the app developer. At the same time, the 
app developer should ensure the image loads.

Does the user of the app care about it [the distinction]? Unlikely. The end 
result is the image isn't loaded. As HTML specifies, the `alt` attribute 
contains the image description, which is more useful to the user in _all_ the 
cases where the image failed to load.

Therefore I think you should fallback to `altAtt` if it's provided.

This actually raises another question: what if `altAtt` isn't provided? Should 
it fallback to `srcURL`?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/15319#discussion_r1368554059

Reply via email to