RFR: 8349121: SSLParameters.setApplicationProtocols() ALPN example could be clarified [v3]

Artur Barashev abarashev at openjdk.org
Thu Feb 6 19:14:15 UTC 2025


On Tue, 4 Feb 2025 19:42:24 GMT, Bradford Wetmore <wetmore at openjdk.org> wrote:

>> Update and clarify the sample code.
>> 
>> Docs only, no additional testing other than verifying javadoc is correctly output.
>
> Bradford Wetmore has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Codereview Comments

src/java.base/share/classes/javax/net/ssl/SSLParameters.java line 666:

> 664:      *     byte[] bytes = HUK_UN_I.getBytes(StandardCharsets.UTF_8);
> 665:      *
> 666:      *     // Preserve network byte order by using ISO_8859_1 encoding

I find `network byte order` wording rather confusing, everything here is big-endian, but I guess that's not what we really mean by that, we really care about encoding. I would just put `Convert to the default ALPN encoding` comment here.

src/java.base/share/classes/javax/net/ssl/SSLParameters.java line 668:

> 666:      *     // Preserve network byte order by using ISO_8859_1 encoding
> 667:      *     String encodedHukUnI =
> 668:      *         new String(bytes, StandardCharsets.ISO_8859_1);

`ISO_8859_1` is the default ALPN encoding but it can be modified by setting `jdk.tls.alpnCharset` system property. We don't mention it.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/23379#discussion_r1945281873
PR Review Comment: https://git.openjdk.org/jdk/pull/23379#discussion_r1945279174


More information about the security-dev mailing list