On Sat, 5 Jun 2021 14:56:15 GMT, Michael Strauß <mstra...@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