mirror of
https://github.com/google/nomulus.git
synced 2025-05-13 07:57:13 +02: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:
parent
438eeb5e38
commit
16c53c6996
2 changed files with 80 additions and 4 deletions
|
@ -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());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue