8353453: URLDecoder should use HexFormat
Reviewed-by: rriggs, jpai
This commit is contained in:
parent
4e24dc003c
commit
03fd43fc91
@ -29,6 +29,7 @@ import java.io.*;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.IllegalCharsetNameException;
|
||||
import java.nio.charset.UnsupportedCharsetException;
|
||||
import java.util.HexFormat;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
@ -204,11 +205,7 @@ public final class URLDecoder {
|
||||
|
||||
while ( ((i+2) < numChars) &&
|
||||
(c=='%')) {
|
||||
int v = Integer.parseInt(s, i + 1, i + 3, 16);
|
||||
if (v < 0)
|
||||
throw new IllegalArgumentException(
|
||||
"URLDecoder: Illegal hex characters in escape "
|
||||
+ "(%) pattern - negative value");
|
||||
int v = HexFormat.fromHexDigits(s, i + 1, i + 3);
|
||||
bytes[pos++] = (byte) v;
|
||||
i+= 3;
|
||||
if (i < numChars)
|
||||
|
Loading…
x
Reference in New Issue
Block a user