JDK-8293246 : Produce warning when user specified java.io.tmpdir directory doesn't exist
  • Type: CSR
  • Component: core-libs
  • Sub-Component: java.io
  • Priority: P4
  • Status: Closed
  • Resolution: Withdrawn
  • Fix Versions: 8-pool,11-pool-oracle,17-pool-oracle,19-pool,20
  • Submitted: 2022-09-01
  • Updated: 2022-09-19
  • Resolved: 2022-09-19
Related Reports
Cloners :  
Description
Summary
-------

Print out warning message when user specified java.io.tmpdir does not exist

Problem
-------

When the directory of java.io.tmpdir is used as a file directory, but it is not set properly, the java.io.IOException is thrown with a generic error message of " No such file or directory". This message would not be able to give a hint to the developer about the configuration of java.io.tmpdir.
See JDK-8290313. 

Solution
--------

Add a static block of the code in the inner class TempDirectory of java.io.File.java and TempFileHelper.java. It will print out an error message when java.io.tmpdir is not a valid directory. 

Specification
-------------

static block of the code inside inner class TempDirectory in File.java
```
 // print out the error message for java.io.tmpdir setting
        static {
            if (tmpdir.isInvalid() || !fs.hasBooleanAttributes(tmpdir, FileSystem.BA_DIRECTORY)) {
                System.err.println("WARNING: java.io.tmpdir location does not exist");
            }
        }
```

static block of the code inside class java.nio.file.TempFileHelper.java
```
  // print out the error message for java.io.tmpdir setting
    static {
        if (!Files.isDirectory(tmpdir)) {
            System.err.println("WARNING: java.io.tmpdir location does not exist");
        }
    }
```

Comments
Close this one and use this one https://bugs.openjdk.org/browse/JDK-8294028 instead
19-09-2022

[~wxiao] I have removed my name from the list of Reviewers as I have not reviewed this CSR. This CSR seems to have been created with clone rather than the "Create CSR" button.
02-09-2022