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

javac and ToolBox do not close opened files.

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Cannot Reproduce
    • Affects Version/s: 9
    • Fix Version/s: 9
    • Component/s: tools
    • Labels:
      None
    • Subcomponent:
    • CPU:
      x86
    • OS:
      windows_8

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: