-
Notifications
You must be signed in to change notification settings - Fork 368
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
SftpFileSystemProvider.newFileChannel() uses wrong default mode #383
Comments
Hi, thank you for taking care of this issue. Sorry for nickpicking, but the description "the channel is opened read-only if no OpenOptions are passed" is not correct. The contract actually is "If neither option ( |
Yes, but I would not read this too literally. All the other options imply write access, don't they? |
I thought specs are meant to be taken literally ;-) but yes, I agree that e.g. |
No sure there's a use case for CREATE, READ. For now I think your change #372 is fine (setting READ if no options). We can change it later to "set READ if neither WRITE nor APPEND present", if needed, but then that should probably be done in other places as well. Do you want to fix the failing tests? I prefer to have master working at any commit, so if you could amend your commit, that'd be great; then I could merge it. |
Sure, I've just force-pushed faf88ec , could you please approve the action workflow run? 👍 |
As pointed out in apache#283, FileSystemProvider.newFileChannel(...) uses READ as default not only when no options are given, but always when neither WRITE nor APPEND are present. Also tighten some other rules, and fail if write modes are specified in newInputStream(...). Bug: apache#383
As pointed out in apache#283, FileSystemProvider.newFileChannel(...) uses READ as default not only when no options are given, but always when neither WRITE nor APPEND are present. Also tighten some other rules, and fail if write modes are specified in newInputStream(...). Bug: apache#383
Version
master
Bug description
According to the contract of
FileSystemProvider.newFileChannel()
per its javadoc, the channel is opened read-only if noOpenOption
s are passed.SftpFileSystemProvider
opens the channel in read-write mode in this case.Actual behavior
Channel is opened read-write, which fails if the remote file is read-only.
Expected behavior
Channel is opened read-only if
SftpFileSystemProvider.newFileChannel(path)
is called withoutOpenOption
s.Relevant log output
No response
Other information
No response
The text was updated successfully, but these errors were encountered: