JDK-8290313 : Produce warning when user specified java.io.tmpdir directory doesn't exist
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.io
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2022-07-14
  • Updated: 2024-01-16
  • Resolved: 2022-11-23
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11 JDK 17 JDK 20 JDK 8
11-pool-oracleResolved 17-pool-oracleResolved 20 b25Fixed 8-poolResolved
Related Reports
Relates :  
Relates :  
Relates :  
Sub Tasks
JDK-8297055 :  
Description
submitter hit an error in use of the java.io.File.createTempFile API - following exception produced:

java.io.IOException: No such file or directory
        at java.io.UnixFileSystem.createFileExclusively(Native Method)
        at java.io.File.createTempFile(File.java:2001)
        at java.io.File.createTempFile(File.java:2047)

turns out that they had supplied a bad, non-existent, directory for the 'java.io.tmpdir' system property

We should investigate if any hint of this can be passed to end user exception
Comments
Changeset: 8df3bc4e Author: Weibing Xiao <weibing.xiao@oracle.com> Committer: Sean Coffey <coffeys@openjdk.org> Date: 2022-11-23 17:10:05 +0000 URL: https://git.openjdk.org/jdk/commit/8df3bc4ec57a15d5bca844e030c8cc3f8c077a49
23-11-2022

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/11174 Date: 2022-11-15 19:02:30 +0000
15-11-2022

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/9989 Date: 2022-08-23 18:32:30 +0000
07-09-2022

I don't think emitting a warning is the right thing to do here. However, there are a number of things that could be explored: 1. Extend jdk.includeInExceptions to include "file", meaning opt-in in secure deployments to include the tmp directory in the exception. 2. A warning at startup if -Djava.io.tmpdir is specified on the command line and the directory does not exist. 3. Emit a JFR event.
24-08-2022