Use Charset variants of URLEncoder and URLDecoder methods

This commit is contained in:
Christoph Dreis
2021-10-13 14:38:58 +02:00
committed by Juergen Hoeller
parent 2fba0bc272
commit 5c972fcc54
11 changed files with 27 additions and 46 deletions

View File

@@ -18,7 +18,6 @@ package org.springframework.test.web.servlet.htmlunit;
import java.io.File;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URL;
import java.net.URLDecoder;
import java.nio.charset.Charset;
@@ -396,12 +395,7 @@ final class HtmlUnitRequestBuilder implements RequestBuilder, Mergeable {
}
private String urlDecode(String value) {
try {
return URLDecoder.decode(value, "UTF-8");
}
catch (UnsupportedEncodingException ex) {
throw new IllegalStateException(ex);
}
return URLDecoder.decode(value, StandardCharsets.UTF_8);
}
private byte[] readAllBytes(File file) {