On Tue, 29 Nov 2022 05:48:26 GMT, Jaikiran Pai <[email protected]> wrote:

> Can I please get a review of this change which proposes to enhance an 
> exception message in `java.net.HostPortrange::toLowerCase`, as requested in 
> https://bugs.openjdk.org/browse/JDK-8297311?
> 
> The commit here includes (only) the character, which was found to be invalid, 
> in the exception message. The character will be printed out in `\uXXXX` 
> format to take into account any unprintable characters.
> 
> A new test has been introduced to verify that the introduction of this change 
> doesn't introduce any regression and does indeed include the expected 
> exception message.

src/java.base/share/classes/java/net/HostPortrange.java line 189:

> 187:                 sb.append((char)(c - CASE_DIFF));
> 188:             } else {
> 189:                 final String invalidChar = String.format("\\u%04x", 
> (int) c);

Why not construct the whole message using String.format? It would avoid the 
string concatenation below...

-------------

PR: https://git.openjdk.org/jdk/pull/11407

Reply via email to