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

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

    Details

    • Type: Bug
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 7
    • Fix Version/s: tbd
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • Introduced In Version:
      1.1
    • CPU:
      generic
    • OS:
      generic

      Description

      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.

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Imported:
                Indexed: