RFR: 8316681: Rewrite URLEncoder.encode to use small reusable buffers [v5]

Claes Redestad redestad at openjdk.org
Fri Sep 22 08:53:11 UTC 2023


On Fri, 22 Sep 2023 08:43:16 GMT, ExE Boss <duke at openjdk.org> wrote:

>> Claes Redestad has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Add comment, split long line
>
> src/java.base/share/classes/java/net/URLEncoder.java line 299:
> 
>> 297:      * Encodes input chars in cb and appends the byte values in an escaped format
>> 298:      * ("%FF") to out. The temporary byte buffer, bb, must be able to accept
>> 299:      * cb.position() * ce.maxBytesPerChar() bytes.
> 
> The following might be better, and also use `"%XX"` instead of `"%FF"`, the latter being 255 in hex:
> Suggestion:
> 
>      * Encodes input chars in {@code cb} and appends the byte values in an escaped
>      * format ({@code "%XX"}) to {@code out}. The temporary byte buffer, {@code bb},
>      * must be able to accept {@code cb.position() * ce.maxBytesPerChar()} bytes.

As this javadoc isn't published anywhere I didn't bother with `{@code..`, but since you've spent time to fix things up then why not. 👍🏽

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

PR Review Comment: https://git.openjdk.org/jdk/pull/15865#discussion_r1334085922


More information about the net-dev mailing list