JDK-8161097 : tools.jar bug with sun.tools.native2ascii.Main
  • Type: Bug
  • Component: tools
  • Affected Version: 7u51
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • Submitted: 2016-07-08
  • Updated: 2016-07-16
  • Resolved: 2016-07-16
Related Reports
Duplicate :  
Description
A bug is reported against sun.tools.native2ascii.Main.convert() in tools.jar
when ojserver/ojdeploy are used in JDeveloper. If multiple deployments are
run on the same folder, using the ojdeploy tool with the -clean and -ojserver
options without restarting ojserver, ojserver will sometimes fail with the
error "Unable to delete ...\\classes\\...\\JDev1141116155786355741.properties".

The problem is with lines 158-172 in the code, showing that a BufferedReader
in and a BufferedWriter out are declared, and BufferedWriter is closed.
However, BufferedReader remains open. 

            } else {
             //N2A
                String inLine;
                BufferedReader in = getN2AInput(inputFileName);
                BufferedWriter out = getN2AOutput(outputFileName);

                while ((inLine = in.readLine()) != null) {
                    out.write(inLine.toCharArray());
                    out.write(lineBreak);
                    if (outputFileName == null) { // flush stdout
                        out.flush();
                    }
                }
                out.close();
            }


Comments
Marking 9-na, since native2ascii was removed in jdk9 with JDK-8074431
11-07-2016