-
Bug
-
Resolution: Fixed
-
P3
-
7
-
b03
-
generic
-
generic
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8298879 | 20 | Brian Burkhalter | P3 | Resolved | Fixed | b29 |
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.
"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.
- backported by
-
JDK-8298879 (fs spec) Files.newBufferedWriter should be clear when coding errors are detected
-
- Resolved
-
- csr for
-
JDK-8298609 (fs spec) Files.newBufferedWriter should be clear when coding errors are detected
-
- Closed
-
- links to
-
Commit openjdk/jdk20/ca39eb90
-
Commit openjdk/jdk/831b35fa
-
Review openjdk/jdk20/36
-
Review openjdk/jdk/11616
(1 links to)