RFR: 8353453: URLDecoder should use HexFormat
Roger Riggs
rriggs at openjdk.org
Tue Apr 1 19:11:17 UTC 2025
On Sat, 29 Mar 2025 17:27:20 GMT, Patrick Strawderman <duke at 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.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/24314#discussion_r2023532637
More information about the net-dev
mailing list