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

(fs) Files.writeString spec for IOException has "specified charset" when no charset is provided

    XMLWordPrintable

Details

    • CSR
    • Resolution: Approved
    • P4
    • 19
    • core-libs
    • None
    • behavioral
    • minimal
    • Matches verbiage to existing behavior so no risk.
    • Java API
    • SE

    Description

      Summary

      Change description of the IOException thrown by java.nio.file.Files.writeString(Path,CharSequence,OpenOption) to state that the charset is UTF-8.

      Problem

      The charset is stated to be "specified charset" when it is always UTF-8.

      Solution

      State "UTF-8" instead of "specified charset."

      Specification

      --- a/src/java.base/share/classes/java/nio/file/Files.java
      +++ b/src/java.base/share/classes/java/nio/file/Files.java
      @@ -3654,7 +3654,7 @@ public final class Files {
            *          if {@code options} contains an invalid combination of options
            * @throws  IOException
            *          if an I/O error occurs writing to or creating the file, or the
      -     *          text cannot be encoded using the specified charset
      +     *          text cannot be encoded using UTF-8
            * @throws  UnsupportedOperationException
            *          if an unsupported option is specified
            * @throws  SecurityException

      Attachments

        Issue Links

          Activity

            People

              bpb Brian Burkhalter
              alanb Alan Bateman
              Iris Clark
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: