A DESCRIPTION OF THE PROBLEM :
If the file does not exist, then setExecutable fails silently.
According to the documentation:
Sets the owner's or everybody's execute permission for this abstract pathname.
Abstract pathname. Means, no matter whether it exists or not.
So if the file is written after setting executable, at the end the file shall be executable.
Accordingly for other setter methods.
I think, the documentation shall mention the case of non existing file explicitly.
I would prefer a return value false in this case.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Choose a filename for a non existing file
File file = new File (<nonexisting>);
boolean success = file.setExecutable(true, false);
file.createNewFile();
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Prefer success == false but my issue is more documentation.
ACTUAL -
success == true, case not documented.
---------- BEGIN SOURCE ----------
see above
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
various, e.g. creating the file before using setExecutable.
FREQUENCY : always
If the file does not exist, then setExecutable fails silently.
According to the documentation:
Sets the owner's or everybody's execute permission for this abstract pathname.
Abstract pathname. Means, no matter whether it exists or not.
So if the file is written after setting executable, at the end the file shall be executable.
Accordingly for other setter methods.
I think, the documentation shall mention the case of non existing file explicitly.
I would prefer a return value false in this case.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Choose a filename for a non existing file
File file = new File (<nonexisting>);
boolean success = file.setExecutable(true, false);
file.createNewFile();
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Prefer success == false but my issue is more documentation.
ACTUAL -
success == true, case not documented.
---------- BEGIN SOURCE ----------
see above
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
various, e.g. creating the file before using setExecutable.
FREQUENCY : always
- csr for
-
JDK-8317117 File.setExecutable silently fails if file does not exist
-
- Closed
-