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

Reviewed-by: naoto, lancea
This commit is contained in:
Brian Burkhalter 2021-06-25 19:08:35 +00:00
parent 3fae4b3720
commit 68ef21db41
2 changed files with 115 additions and 1 deletions

View file

@ -2110,6 +2110,13 @@ public class File
* is invoked, but programmatic changes to this property are not guaranteed
* to have any effect upon the temporary directory used by this method.
*
* <p> If the {@code directory} argument is not {@code null} and its
* abstract pathname is valid and denotes an existing, writable directory,
* then the file will be created in that directory. Otherwise the file will
* not be created and an {@code IOException} will be thrown. Under no
* circumstances will a directory be created at the location specified by
* the {@code directory} argument.
*
* @param prefix The prefix string to be used in generating the file's
* name; must be at least three characters long
*
@ -2127,7 +2134,8 @@ public class File
* If the {@code prefix} argument contains fewer than three
* characters
*
* @throws IOException If a file could not be created
* @throws IOException
* If a file could not be created
*
* @throws SecurityException
* If a security manager exists and its {@link
@ -2149,6 +2157,7 @@ public class File
File tmpdir = (directory != null) ? directory
: TempDirectory.location();
@SuppressWarnings("removal")
SecurityManager sm = System.getSecurityManager();
File f;