RFR: 8290313: Produce warning when user specified java.io.tmpdir directory doesn't exist

David Schlosnagle duke at openjdk.org
Wed Sep 7 15:20:34 UTC 2022


On Tue, 23 Aug 2022 18:32:30 GMT, Weibing Xiao <duke at openjdk.org> wrote:

> 8290313: Produce warning when user specified java.io.tmpdir directory doesn't exist

src/java.base/share/classes/java/io/File.java line 2180:

> 2178: 
> 2179: 
> 2180:         if(!tmpdir.exists() || !tmpdir.canWrite()) {

Should this check that `tmpdir.isDirectory()` that will do both existence & directory check? That would catch if java.io.t odor was mistakenly set to an existing (writable) file.

Suggestion:

        if(!tmpdir.isDirectory() || !tmpdir.canWrite()) {

src/java.base/share/classes/java/io/File.java line 2181:

> 2179: 
> 2180:         if(!tmpdir.exists() || !tmpdir.canWrite()) {
> 2181:             throw new IOException("The specified directory does no exist or is not accessible! " +

Spelling nit:

Suggestion:

            throw new IOException("The specified directory does not exist or is not accessible! " +

-------------

PR: https://git.openjdk.org/jdk/pull/9989


More information about the core-libs-dev mailing list