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

(fs spec) Files.newBufferedWriter should be clear when coding errors are detected

    XMLWordPrintable

Details

    • b03
    • generic
    • generic

    Backports

      Description

        The spec on java.nio.file.Files.newBufferedWriter states:

        "The Writer methods to write text throw IOException if the text cannot be encoded using the specified charset."

        Actually write methods do not guarantie to fail in that case: they only fail when flushing to the underlying writer. For example:

        BufferedWriter wr = Files.newBufferedWriter(path, Charset.forName("US-ASCII"));
        wr.write("\u00ff"); // does NOT throw IOE
        wr.flush(); // or wr.close() throws IOE

        The spec should clarify that behavior.

        Attachments

          Issue Links

            Activity

              People

                bpb Brian Burkhalter
                asutchil Arkadiy Sutchilin (Inactive)
                Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: