BufferedWriter.close throws UnmappableCharacterException after it has been already thrown by flush()

XMLWordPrintable

    • Type: Bug
    • Resolution: Unresolved
    • Priority: P4
    • tbd
    • Affects Version/s: 7
    • Component/s: core-libs
    • 1.1
    • generic
    • generic

      Consider the following code:

      BufferedWriter wr;
      try {
        wr = Files.newBufferedWriter(path, Charset.forName("US-ASCII"));
        wr.write("\u00ff"); // unmappable character written
        wr.flush(); // expectedly throws IOE
      } catch (IOException ioe) {
        . . .
      } finally {
        if (wr != null) {
          wr.close(); // unexpectedly throws IOE !!!
        }
      }

      The IOE (actually UnmappableCharacterException) is thrown by close() method unexpectedly.

            Assignee:
            Unassigned
            Reporter:
            Arkadiy Sutchilin (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Imported:
              Indexed: