On Tue, Jun 9, 2020 at 8:08 AM Bill Stewart <bstew...@iname.com> wrote:
[ snip ]
> Also, "file not found" is not the same as "access denied". You should
> post the exact error line(s) from your log.

A bit off-topic, but wanted to jump in and clear this up, as the Java
error messages are somewhat misleading.
If I write a class to open a read-only file with
java.io.FileOutputStream, I will see this stack trace

calder@stimpy:~/bin> ./jdk180-221/bin/java AccessDenied
java.io.FileNotFoundException: tester.txt (Permission denied)
        at java.io.FileOutputStream.open0(Native Method)
...
calder@stimpy:~/bin> ls -l tester.txt
-r--r--r-- 1 calder users 0 Jun  9 10:12 tester.txt

FileOutputStream ctors and methods throw the FileNotFoundException and
the more specific error [in this case] is "Permission denied".
So yea, it's confusing.

If you check the source code for FileNotFoundException, we even see a
comment related to this
[quote]
This exception will be thrown by the {@link FileInputStream}, {@link
 FileOutputStream}, and {@link RandomAccessFile} constructors when a file
 with the specified pathname does not exist.  It will also be thrown by these
 constructors if the file does exist but for some reason is inaccessible, for
 example when an attempt is made to open a read-only file for writing.
[/quote]

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to