8297311: Improve exception message thrown by java.net.HostPortrange::toLowerCase(String s)

Reviewed-by: dfuchs, michaelm, rriggs
This commit is contained in:
Jaikiran Pai 2022-11-30 01:11:24 +00:00
parent defe0607e3
commit 9ced2ea0ab
2 changed files with 59 additions and 1 deletions

View file

@ -186,7 +186,8 @@ class HostPortrange {
}
sb.append((char)(c - CASE_DIFF));
} else {
throw new IllegalArgumentException("Invalid characters in hostname");
final String message = String.format("Invalid character \\u%04x in hostname", (int) c);
throw new IllegalArgumentException(message);
}
}
return sb == null ? s : sb.toString();