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

Jaikiran Pai jpai at openjdk.org
Tue Nov 29 12:56:06 UTC 2022


On Tue, 29 Nov 2022 12:35:36 GMT, Daniel Fuchs <dfuchs at openjdk.org> wrote:

>> Jaikiran Pai has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   review comment
>
> 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...

That's certainly better. I've now updated the PR to follow that suggestion. The new test continues to pass.

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

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


More information about the net-dev mailing list