8316000: File.setExecutable silently fails if file does not exist

Reviewed-by: alanb
This commit is contained in:
Brian Burkhalter 2023-09-29 15:03:10 +00:00
parent a185be0346
commit 49376e4452

View File

@ -1621,6 +1621,12 @@ public class File
* file attributes including file permissions. This may be used when finer
* manipulation of file permissions is required.
*
* <p> If the platform supports setting a file's read permission, but
* the user does not have permission to change the access permissions of
* this abstract pathname, then the operation will fail. If the platform
* does not support setting a file's read permission, this method does
* nothing and returns the value of the {@code readable} parameter.
*
* @param readable
* If {@code true}, sets the access permission to allow read
* operations; if {@code false} to disallow read operations
@ -1632,12 +1638,9 @@ public class File
* permission from that of others, then the permission will apply to
* everybody, regardless of this value.
*
* @return {@code true} if and only if the operation succeeded. The
* operation will fail if the user does not have permission to
* change the access permissions of this abstract pathname. If
* {@code readable} is {@code false} and the underlying
* file system does not implement a read permission, then the
* operation will fail.
* @return {@code true} if the operation succeeds, {@code false} if it
* fails, or the value of the {@code readable} parameter if
* setting the read permission is not supported.
*
* @throws SecurityException
* If a security manager exists and its {@link
@ -1671,16 +1674,19 @@ public class File
* file.setReadable(arg, true)
* }
*
* <p> If the platform supports setting a file's read permission, but
* the user does not have permission to change the access permissions of
* this abstract pathname, then the operation will fail. If the platform
* does not support setting a file's read permission, this method does
* nothing and returns the value of the {@code readable} parameter.
*
* @param readable
* If {@code true}, sets the access permission to allow read
* operations; if {@code false} to disallow read operations
*
* @return {@code true} if and only if the operation succeeded. The
* operation will fail if the user does not have permission to
* change the access permissions of this abstract pathname. If
* {@code readable} is {@code false} and the underlying
* file system does not implement a read permission, then the
* operation will fail.
* @return {@code true} if the operation succeeds, {@code false} if it
* fails, or the value of the {@code readable} parameter if
* setting the read permission is not supported.
*
* @throws SecurityException
* If a security manager exists and its {@link
@ -1703,6 +1709,12 @@ public class File
* file attributes including file permissions. This may be used when finer
* manipulation of file permissions is required.
*
* <p> If the platform supports setting a file's execute permission, but
* the user does not have permission to change the access permissions of
* this abstract pathname, then the operation will fail. If the platform
* does not support setting a file's execute permission, this method does
* nothing and returns the value of the {@code executable} parameter.
*
* @param executable
* If {@code true}, sets the access permission to allow execute
* operations; if {@code false} to disallow execute operations
@ -1714,12 +1726,9 @@ public class File
* execute permission from that of others, then the permission will
* apply to everybody, regardless of this value.
*
* @return {@code true} if and only if the operation succeeded. The
* operation will fail if the user does not have permission to
* change the access permissions of this abstract pathname. If
* {@code executable} is {@code false} and the underlying
* file system does not implement an execute permission, then the
* operation will fail.
* @return {@code true} if the operation succeeds, {@code false} if it
* fails, or the value of the {@code executable} parameter if
* setting the execute permission is not supported.
*
* @throws SecurityException
* If a security manager exists and its {@link
@ -1753,16 +1762,19 @@ public class File
* file.setExecutable(arg, true)
* }
*
* <p> If the platform supports setting a file's execute permission, but
* the user does not have permission to change the access permissions of
* this abstract pathname, then the operation will fail. If the platform
* does not support setting a file's execute permission, this method does
* nothing and returns the value of the {@code executable} parameter.
*
* @param executable
* If {@code true}, sets the access permission to allow execute
* operations; if {@code false} to disallow execute operations
*
* @return {@code true} if and only if the operation succeeded. The
* operation will fail if the user does not have permission to
* change the access permissions of this abstract pathname. If
* {@code executable} is {@code false} and the underlying
* file system does not implement an execute permission, then the
* operation will fail.
* @return {@code true} if the operation succeeds, {@code false} if it
* fails, or the value of the {@code executable} parameter if
* setting the execute permission is not supported.
*
* @throws SecurityException
* If a security manager exists and its {@link