RFR: 8267551: Support loading images from inline data-URIs [v13]
Kevin Rushforth
kcr at openjdk.java.net
Sat Jun 5 15:10:57 UTC 2021
On Sat, 5 Jun 2021 14:56:15 GMT, Michael Strauß <mstrauss at openjdk.org> wrote:
>> modules/javafx.graphics/src/main/java/com/sun/javafx/util/DataURI.java line 47:
>>
>>> 45: }
>>> 46:
>>> 47: int firstNonWhitespace = 0, length = uri.length();
>>
>> Why do you need to trim leading spaces? The input URL strings should already be trimmed by the caller.
>
> I implemented it in this way so that this requirement is not imposed onto the caller, similar to `java.net.URL` does not impose this requirement onto its callers. I can imagine that `DataURI` might be used in other places, so it might make sense to make it more robust with regards to leading whitespace?
In that case, it might be clearer and simpler to just call `trim()` on the input String before doing anything with it, unless there is a reason not to.
-------------
PR: https://git.openjdk.java.net/jfx/pull/508
More information about the openjfx-dev
mailing list