On Tue, 1 Apr 2025 19:08:13 GMT, Roger Riggs <rri...@openjdk.org> wrote:

>> Use `HexFormat.fromHexDigits` in URLDecoder, instead of `Integer.parseInt`.
>
> src/java.base/share/classes/java/net/URLDecoder.java line 208:
> 
>> 206:                     while ( ((i+2) < numChars) &&
>> 207:                             (c=='%')) {
>> 208:                         int v = HexFormat.fromHexDigits(s, i + 1, i + 
>> 3);
> 
> Its worth noting that the exceptions thrown by HexFormat.fromHexDigits are 
> different than those thrown by Integer.parseInt, as to the specific type and 
> exception message.

They are both NumberFormatException that is immediately handled by an enclosing 
catch block. This change should only affect the exception message for inputs 
fragments like %-F.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/24314#discussion_r2023780945

Reply via email to