mirror of
https://github.com/google/nomulus
synced 2026-01-06 21:47:31 +00:00
Fix uncaught LEADING_HYPHEN IllegalArgumentException in host flows
This should have been getting turned into an InvalidHostNameException, but wasn't. I've added tests for HostFlowUtils verifying the correct behavior for this. Idn.toASCII() can throw IllegalArgumentException for some combinations of input, including hostnames with a leading hyphen, so the call should be inside the try block that turns IAEs into InvalidHostNameExceptions. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=139373849
This commit is contained in:
@@ -47,11 +47,11 @@ public class HostFlowUtils {
|
||||
if (!name.equals(hostNameLowerCase)) {
|
||||
throw new HostNameNotLowerCaseException(hostNameLowerCase);
|
||||
}
|
||||
String hostNamePunyCoded = Idn.toASCII(name);
|
||||
if (!name.equals(hostNamePunyCoded)) {
|
||||
throw new HostNameNotPunyCodedException(hostNamePunyCoded);
|
||||
}
|
||||
try {
|
||||
String hostNamePunyCoded = Idn.toASCII(name);
|
||||
if (!name.equals(hostNamePunyCoded)) {
|
||||
throw new HostNameNotPunyCodedException(hostNamePunyCoded);
|
||||
}
|
||||
InternetDomainName hostName = InternetDomainName.from(name);
|
||||
if (!name.equals(hostName.toString())) {
|
||||
throw new HostNameNotNormalizedException(hostName.toString());
|
||||
|
||||
Reference in New Issue
Block a user