On Sat, 5 Jun 2021 08:21:14 GMT, John Hendrikx <jhendr...@openjdk.org> wrote:
>> Michael Strauß has updated the pull request with a new target base due to a >> merge or a rebase. The pull request now contains 15 commits: >> >> - Merge branch 'master' into feature/image-datauri >> >> # Conflicts: >> # >> modules/javafx.graphics/src/test/java/test/com/sun/javafx/iio/ImageStorageTest.java >> - Accept regular file paths, change javadoc >> - Merge branch 'openjdk:master' into feature/image-datauri >> - Rename DataURI.isValidURI >> - Reverted a change >> - Allow leading and trailing whitespace in data URI >> - Removed test >> - Changed data URI detection >> - Merge branch 'master' into feature/image-datauri >> - Moved test >> - ... and 5 more: >> https://git.openjdk.java.net/jfx/compare/7b7050c4...315523c5 > > 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. ------------- PR: https://git.openjdk.java.net/jfx/pull/508