Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8317246

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

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 22
    • 22
    • core-libs
    • None
    • b18

      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).

      Since Charset.defaultCharset() is also initialized with StaticProperty.fileEncoding(), this causes no change in behavior.

      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.

            redestad Claes Redestad
            rriggs Roger Riggs
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: