Uploaded image for project: 'Code Tools'
  1. Code Tools
  2. CODETOOLS-7903988

IDEA plugin: temp directories don't work on Windows

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • None
    • None
    • tools
    • None

      To find the temporary directory on Windows, one of the environment variables TMP, TEMP, or USERPROFILE is needed [1]. If these are not set, C:\WINDOWS is used as a fallback, but this directory is typically inaccessible (and generally not really a directory you want to leave temp files).

      However, the IDEA plugin currently doesn't forward these variables to the jtreg process that it starts, resulting in them being unset. For tests that e.g. create temporary files or directories, this result in an AccessDeniedException such as:

      java.nio.file.AccessDeniedException: C:\\WINDOWS\\asdf12599356154200781179
      at java.base/sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:89)
      at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:103)
      at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:108)
      at java.base/sun.nio.fs.WindowsFileSystemProvider.newByteChannel(WindowsFileSystemProvider.java:231)
      at java.base/java.nio.file.Files.newByteChannel(Files.java:357)
      at java.base/java.nio.file.Files.createFile(Files.java:609)
      at java.base/java.nio.file.TempFileHelper.create(TempFileHelper.java:132)
      at java.base/java.nio.file.TempFileHelper.createTempFile(TempFileHelper.java:150)
      at java.base/java.nio.file.Files.createTempFile(Files.java:842)
      at TestTempDir.testTempDir(TestTempDir.java:39)

      The plugin should forward these environment variables on Windows, to make sure that the temporary directory can be found by tests.

      [1]: https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-gettemppatha#remarks

            jvernee Jorn Vernee
            jvernee Jorn Vernee
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: