RFR: 4847239: (spec) File.createTempFile() should make it clear that it doesn't create the temporary directory [v2]

Naoto Sato naoto at openjdk.java.net
Thu Jun 24 18:22:10 UTC 2021


On Wed, 23 Jun 2021 23:02:01 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

>> Augment the specification of `java.io.File.createTempFile(String,String,File)` to clarify its behavior with respect to the `File` parameter `directory`.
>
> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
> 
>   4847239: Add test

Thanks for adding the test. Some nits follow.

test/jdk/java/io/File/createTempFile/TargetDirectory.java line 58:

> 56:         if (Files.getFileStore(dir).supportsFileAttributeView("posix")) {
> 57:             PosixFileAttributeView view =
> 58:                 (PosixFileAttributeView)Files.getFileAttributeView(dir,

Casting seems not needed.

test/jdk/java/io/File/createTempFile/TargetDirectory.java line 83:

> 81:         try {
> 82:             File.createTempFile("readonly", null, target);
> 83:             throw new RuntimeException("Exception not thrown");

Probably replacing the message `Exception not thrown` with a more explanatory one would help, as there are other locations below, which could throw the same message.

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

PR: https://git.openjdk.java.net/jdk/pull/4561


More information about the core-libs-dev mailing list