From 9122724cb908431cafc0fa0e8f1d2c044fea0bf9 Mon Sep 17 00:00:00 2001 From: bg0d-droid Date: Thu, 11 Jun 2026 15:41:30 -0700 Subject: [PATCH] Clarify `HostSpecifier` compatibility with `java.net.URI` parsing. Fixes https://github.com/google/guava/pull/8459 RELNOTES=n/a PiperOrigin-RevId: 930777906 --- android/guava/src/com/google/common/net/HostSpecifier.java | 7 +++++++ guava/src/com/google/common/net/HostSpecifier.java | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/android/guava/src/com/google/common/net/HostSpecifier.java b/android/guava/src/com/google/common/net/HostSpecifier.java index 51d80fbcc218..4be093e6ae0b 100644 --- a/android/guava/src/com/google/common/net/HostSpecifier.java +++ b/android/guava/src/com/google/common/net/HostSpecifier.java @@ -30,6 +30,13 @@ * URI, the domain name case is further restricted to include only those domain names which end in a * recognized public suffix; see {@link InternetDomainName#isPublicSuffix()} for details. * + *

In this context, "URI" is used in the general sense, and {@code HostSpecifier} does not + * guarantee that every URI or URL parser will accept the original input without additional + * normalization. {@code HostSpecifier} follows the syntactic rules of {@link InetAddresses} and + * {@link InternetDomainName}, including their documented acceptance of some inputs that particular + * URI implementations may reject, such as non-ASCII digits, non-ASCII domain names, or domain + * labels containing underscores. + * *

Note that no network lookups are performed by any {@code HostSpecifier} methods. No attempt is * made to verify that a provided specifier corresponds to a real or accessible host. Only syntactic * and pattern-based checks are performed. diff --git a/guava/src/com/google/common/net/HostSpecifier.java b/guava/src/com/google/common/net/HostSpecifier.java index 51d80fbcc218..4be093e6ae0b 100644 --- a/guava/src/com/google/common/net/HostSpecifier.java +++ b/guava/src/com/google/common/net/HostSpecifier.java @@ -30,6 +30,13 @@ * URI, the domain name case is further restricted to include only those domain names which end in a * recognized public suffix; see {@link InternetDomainName#isPublicSuffix()} for details. * + *

In this context, "URI" is used in the general sense, and {@code HostSpecifier} does not + * guarantee that every URI or URL parser will accept the original input without additional + * normalization. {@code HostSpecifier} follows the syntactic rules of {@link InetAddresses} and + * {@link InternetDomainName}, including their documented acceptance of some inputs that particular + * URI implementations may reject, such as non-ASCII digits, non-ASCII domain names, or domain + * labels containing underscores. + * *

Note that no network lookups are performed by any {@code HostSpecifier} methods. No attempt is * made to verify that a provided specifier corresponds to a real or accessible host. Only syntactic * and pattern-based checks are performed.