diff options
author | jonmv <venstad@gmail.com> | 2022-04-09 14:55:21 +0200 |
---|---|---|
committer | jonmv <venstad@gmail.com> | 2022-04-09 14:55:21 +0200 |
commit | 52d13729ce5760203025bda4d5022dcdbef3afd2 (patch) | |
tree | 431cc07b031e12f3997e3bbef38b3f81fd9a0ac6 /vespajlib/src/main | |
parent | cb1eb57fa9707b1186f0aa10a0853780d7674742 (diff) |
Domain names may end with ., but hostnames may not
Diffstat (limited to 'vespajlib/src/main')
-rw-r--r-- | vespajlib/src/main/java/ai/vespa/http/DomainName.java | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/vespajlib/src/main/java/ai/vespa/http/DomainName.java b/vespajlib/src/main/java/ai/vespa/http/DomainName.java index 737f6b6d863..86242a1af0c 100644 --- a/vespajlib/src/main/java/ai/vespa/http/DomainName.java +++ b/vespajlib/src/main/java/ai/vespa/http/DomainName.java @@ -16,16 +16,16 @@ import static ai.vespa.validation.Validation.requireMatch; public class DomainName extends PatternedStringWrapper<DomainName> { protected static final Pattern labelPattern = Pattern.compile("([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9-]{0,61}[A-Za-z0-9])"); - protected static final Pattern domainNamePattern = Pattern.compile("(" + labelPattern + "\\.)*" + labelPattern); + protected static final Pattern domainNamePattern = Pattern.compile("(" + labelPattern + "\\.)*" + labelPattern + "\\.?"); public static final DomainName localhost = DomainName.of("localhost"); - protected DomainName(String value) { - super(requireLength(value, "domain name length", 1, 255), domainNamePattern, "domain name"); + protected DomainName(String value, String description) { + super(requireLength(value, "domain name length", 1, 255), domainNamePattern, description); } public static DomainName of(String value) { - return new DomainName(value); + return new DomainName(value, "domain name"); } public static String requireLabel(String label) { |