RFR: 8311216: DataURI can lose information in some charset environments [v4]

Andy Goryachev angorya at openjdk.org
Mon Oct 30 18:55:46 UTC 2023


On Mon, 30 Oct 2023 18:45:51 GMT, Michael Strauß <mstrauss at openjdk.org> wrote:

>> modules/javafx.graphics/src/main/java/com/sun/javafx/util/DataURI.java line 221:
>> 
>>> 219: 
>>> 220:         ExpectedCharacter expectedCharacter = ExpectedCharacter.DEFAULT;
>>> 221:         byte[] output = new byte[computePayloadSize(input)];
>> 
>> just a thought: what if the url contains no %?  in this case one can simply return the input string.
>> I think we could return -1 from computePayloadSize() to indicate that condition.
>
> The return value is not a string, it's a byte array. So we need to do the conversion anyway, which is what this method is doing quite efficiently by now. It's probably not useful to use another conversion method instead, at least not in terms of performance.

oh yeah.  thanks!

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

PR Review Comment: https://git.openjdk.org/jfx/pull/1165#discussion_r1376677138


More information about the openjfx-dev mailing list