RFR: 8267551: Support loading images from inline data-URIs [v13]

Kevin Rushforth kcr at openjdk.java.net
Sat Jun 5 16:14:57 UTC 2021


On Sat, 5 Jun 2021 15:49:16 GMT, Michael Strauß <mstrauss at openjdk.org> wrote:

>> modules/javafx.graphics/src/main/java/com/sun/javafx/css/StyleManager.java line 776:
>> 
>>> 774:                                 } else {
>>> 775:                                     logger.warning("Error loading image: " + url);
>>> 776:                                 }
>> 
>> So if I understand this correctly, an Image is first loaded via the standard mechanism, and if that fails for any reason (`image.isError()`) a second attempt is made through `DataURI` ?
>> 
>> Would it not be better to register a new protocol so `new Image` would just succeed for data uri's ?
>
> In this specific case, image loading has failed for some reason. The call to `DataURI.tryParse` is only there to potentially call `DataURI.toString()` for a truncated log output, instead of logging the entire `url` String. If data-URI truncation is not wanted, this code can be reverted.

Maybe add a brief comment to that effect?

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

PR: https://git.openjdk.java.net/jfx/pull/508


More information about the openjfx-dev mailing list