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

Native2ascii doesn't close one of the streams it opens

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P4
    • 9
    • 8, 9
    • core-libs
    • None

    Backports

      Description

        From the 1.8 open jdk sources:
        159 } else {
        160 //N2A
        161 String inLine;
        162 BufferedReader in = getN2AInput(inputFileName);
        163 BufferedWriter out = getN2AOutput(outputFileName);
        164
        165 while ((inLine = in.readLine()) != null) {
        166 out.write(inLine.toCharArray());
        167 out.write(lineBreak);
        168 if (outputFileName == null) { // flush stdout
        169 out.flush();
        170 }
        171 }
        172 out.close();
        173}

        Notice 'in' is never closed. This causes problems on NFS mounts where .nfsXXXX files are left behind.
        There is also no protection against exceptions, streams should be closed in finally blocks or by using try/resources.

        Attachments

          Issue Links

            Activity

              People

                bpb Brian Burkhalter
                kbronkho Keimpe Bronkhorst (Inactive)
                Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: