Integrated: 8317246: Cleanup java.net.URLEncoder and URLDecoder use of file.encoding property

Glavo duke at openjdk.org
Tue Oct 3 10:37:45 UTC 2023


On Sat, 19 Aug 2023 09:05:47 GMT, Glavo <duke at openjdk.org> wrote:

> `DEFAULT_ENCODING_NAME ` in `URLEncoder` and `URLDecoder` can be replaced with `Charset.defaultCharset()`, which removes unnecessary static fields and avoid looking up charset when calling `URLDecoder.decode(String)` and `URLEncoder.encode(String)`.
> 
> This PR is trivial, since `Charset.defaultCharset()` is also initialized with `StaticProperty.fileEncoding()`, this causes no change in behavior. 
> 
> Moreover, the javadoc of `URLDecoder.decode(String)` and `URLEncoder.encode(String)` say that they use the default charset, so this change is semantically consistent with the documentation.

This pull request has now been integrated.

Changeset: 3bcfac18
Author:    Glavo <zjx001202 at gmail.com>
Committer: Claes Redestad <redestad at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/3bcfac18c39d83bf876787e7ce422831bab0db2f
Stats:     30 lines in 2 files changed: 0 ins; 27 del; 3 mod

8317246: Cleanup java.net.URLEncoder and URLDecoder use of file.encoding property

Reviewed-by: rriggs, naoto

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

PR: https://git.openjdk.org/jdk/pull/15353


More information about the net-dev mailing list