RFR: 6616245: NullPointerException when using JFileChooser with a custom FileView [v2]

Tejesh R tr at openjdk.org
Mon Oct 3 12:00:20 UTC 2022


On Mon, 3 Oct 2022 11:49:41 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:

>> Why not request the path to the system temporary directory?
>> 
>> Temporary directory on Windows is not located in `C:\temp`. Likely this folder does not exist. You should use `TMP` or `TEMP` environment variable. Alternatively, you can use `createTempFile` from from [`java.io.File`](https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/io/File.html#createTempFile(java.lang.String,java.lang.String)) or [`java.nio.Files`](https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/nio/file/Files.html#createTempFile(java.lang.String,java.lang.String,java.nio.file.attribute.FileAttribute...)) to create a file in the temp directory, its parent is the path to the temp directory.
>
> User's home could be a better option. It's guaranteed to exist, `user.home` system property points to it. And it's a more real-life scenario.

Then I can just make user.home directory as the only traversable.......?

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

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



More information about the client-libs-dev mailing list