On Wed, 29 Apr 2026 01:57:05 GMT, Artur Barashev <[email protected]> wrote:
>> Volkan Yazici has updated the pull request incrementally with one additional
>> commit since the last revision:
>>
>> Big facelift
>
> src/java.base/share/classes/javax/net/ssl/SNIHostName.java line 560:
>
>> 558: if (!strict) {
>> 559: return;
>> 560: }
>
> Since we are doing this `strict` overhaul, I think this is a good time to
> also add a proper DNS format validation by calling this
> [DNSName](https://github.com/openjdk/jdk/blob/13c92d0d4d137c7d83a946d1fcd2dfc5686e7b51/src/java.base/share/classes/sun/security/x509/DNSName.java#L143)
> constructor. We recently updated it with additional checks.
In 7f07ab24c67, I've added `DNSName::new` to _strict checks_.
Recall that I had added a "DNS hostname validation" subsection to the method
docs earlier. It is mostly a better presentation of what was already there. I
personally was not happy with it, since it makes the API specification very
explicit and hence rigid about how we perform checks. It leaves no room to
change (loosen or tighten) checks, which is the main reason we could not
re-purpose `SNIHostName::new` methods.
With the addition of `DNSName::new` to strict checks performed by the newly
added static factory methods, the exact definition of "DNS hostname validation"
became even more sophisticated. I took this opportunity to remove that section
from the newly added static factory methods, and instead just add a
"Translation of non-ASCII Unicode code points" subsection. Given we already
have an `@apiNote` telling users to catch `IAE`, IMHO, removal of explanation
on performed checks gives us enough room for future evolution without breaking
compatibility.
In short,
- **Before:** All `SNIHostName::new` and `SNIHostName::of*` family had a "DNS
hostname validation" subsection
- **After:** `SNIHostName::new` family has a "DNS hostname validation"
subsection, `SNIHostName::of*` family has a "Translation of non-ASCII Unicode
code points" subsection
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/30747#discussion_r3173249439