Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(System)FileSystem::source Throws FileNotFoundException For Permissions Issues #344

Open
saidooubella opened this issue Jun 16, 2024 · 1 comment

Comments

@saidooubella
Copy link

I am aware of this issue since it is a JDK problem and it exists as far as I know only on the JVM (I tested the MacOSArm64 target as well and It doesn't have this problem).
With this inconsistency you can't tell wether the file is not found or the issue with the permissions without doing some nasty hacks.

To replicate this problem try calling SystemFileSystem::source with an existing file with no reading permissions and inspect the class of the thrown error and repeat the same thing with an invalid path.

@fzhinkin
Copy link
Collaborator

@saidooubella thanks for pointing to the issue!

FileInputStream's open always throws FileNotFoundException with a message consisting of a file path and a reason inferred from the errno.

I don't really like the idea of parsing an exception message to decide which exact exception to throw. Perhaps, we should remove explicit references to FileNotFoundException from KDoc and mention generic IOException only.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants