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

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

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • 7
    • 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.

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

              Created:
              Updated:
              Imported:
              Indexed: