mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8317246: Cleanup java.net.URLEncoder and URLDecoder use of file.encoding property
Reviewed-by: rriggs, naoto
This commit is contained in:
parent
b6a97c0780
commit
3bcfac18c3
2 changed files with 3 additions and 30 deletions
|
@ -25,8 +25,6 @@
|
|||
|
||||
package java.net;
|
||||
|
||||
import jdk.internal.util.StaticProperty;
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.IllegalCharsetNameException;
|
||||
|
@ -90,9 +88,6 @@ public class URLDecoder {
|
|||
*/
|
||||
private URLDecoder() {}
|
||||
|
||||
// The default charset
|
||||
private static final String DEFAULT_ENCODING_NAME = StaticProperty.fileEncoding();
|
||||
|
||||
/**
|
||||
* Decodes a {@code x-www-form-urlencoded} string.
|
||||
* The default charset is used to determine what characters
|
||||
|
@ -106,16 +101,7 @@ public class URLDecoder {
|
|||
*/
|
||||
@Deprecated
|
||||
public static String decode(String s) {
|
||||
|
||||
String str = null;
|
||||
|
||||
try {
|
||||
str = decode(s, DEFAULT_ENCODING_NAME);
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
// The system should always have the default charset
|
||||
}
|
||||
|
||||
return str;
|
||||
return decode(s, Charset.defaultCharset());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -41,7 +41,6 @@ import java.util.HexFormat;
|
|||
import java.util.function.IntPredicate;
|
||||
|
||||
import jdk.internal.util.ImmutableBitSetPredicate;
|
||||
import jdk.internal.util.StaticProperty;
|
||||
|
||||
/**
|
||||
* Utility class for HTML form encoding. This class contains static methods
|
||||
|
@ -87,7 +86,6 @@ import jdk.internal.util.StaticProperty;
|
|||
*/
|
||||
public class URLEncoder {
|
||||
private static final IntPredicate DONT_NEED_ENCODING;
|
||||
private static final String DEFAULT_ENCODING_NAME;
|
||||
|
||||
static {
|
||||
|
||||
|
@ -139,8 +137,6 @@ public class URLEncoder {
|
|||
bitSet.set('*');
|
||||
|
||||
DONT_NEED_ENCODING = ImmutableBitSetPredicate.of(bitSet);
|
||||
|
||||
DEFAULT_ENCODING_NAME = StaticProperty.fileEncoding();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -161,16 +157,7 @@ public class URLEncoder {
|
|||
*/
|
||||
@Deprecated
|
||||
public static String encode(String s) {
|
||||
|
||||
String str = null;
|
||||
|
||||
try {
|
||||
str = encode(s, DEFAULT_ENCODING_NAME);
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
// The system should always have the default charset
|
||||
}
|
||||
|
||||
return str;
|
||||
return encode(s, Charset.defaultCharset());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue