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

javac and ToolBox do not close opened files.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: P3 P3
    • 9
    • 9
    • tools
    • None
    • x86
    • windows_8

      Failures have been seen where jtreg has not been able to cleanup the scratch directory.
      The root cause is two fold:
      Cause 1: ToolBox does not close and release the resources when a test is run via the
      runAPI method, we need to do something like this:

      diff --git a/test/tools/lib/ToolBox.java b/test/tools/lib/ToolBox.java
      --- a/test/tools/lib/ToolBox.java
      +++ b/test/tools/lib/ToolBox.java
      @@ -1029,7 +1029,9 @@
                           allOpts,
                           classes,
                           allFiles);
      - return ((JavacTaskImpl) task).doCall().exitCode;
      + int rc = ((JavacTaskImpl) task).doCall().exitCode;
      + fileManager.close();
      + return rc;
               }


      Cause 2: the above will still not work for certain cases, here is why:
      a Jar inserted on to the class path via a class-path manifest entry in a Jar,
      and also the JAR which contains the entry will not be added to the
      StandardJavaFileManager list of known resources thus calling fileManager.close()
      will not close the said resource. This behavior is exhibited by the test
       test/tools/javac/Paths/AbsolutePathTest.java
      A sanity check would be is to check if both test.jar and test2.jar are released.

            jjg Jonathan Gibbons
            ksrini Kumar Srinivasan
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: