-
Notifications
You must be signed in to change notification settings - Fork 1.1k
GH-3247: Fix SftpSession.exists
for error code
#3248
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
Conversation
Fixes spring-projects#3247 When there is no path on the SFTP server, a `ChannelSftp.SSH_FX_NO_SUCH_FILE` error is returned in the thrown `SftpException`. * Fix `SftpSession.exists()` to check for the `SSH_FX_NO_SUCH_FILE` to return `false` and re-throw an exception otherwise * Add mock test for `SftpSession.exists()` * Add `org.mockito.AdditionalMatchers` to `checkstyle.xml` exclusions **Cherry-pick to 5.2.x & 5.1.x**
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but I think we need a test against the mina server, e.g. in SftpServerOutboundTests
to verify we actually get that result from JSch.
Probably not related but
|
It isn't related, indeed, but I can't figure out such a sporadic failure. Something is broken sometimes on Mina. Feel free to merge! Thanks |
* GH-3247: Fix `SftpSession.exists` for error code Fixes #3247 When there is no path on the SFTP server, a `ChannelSftp.SSH_FX_NO_SUCH_FILE` error is returned in the thrown `SftpException`. * Fix `SftpSession.exists()` to check for the `SSH_FX_NO_SUCH_FILE` to return `false` and re-throw an exception otherwise * Add mock test for `SftpSession.exists()` * Add `org.mockito.AdditionalMatchers` to `checkstyle.xml` exclusions **Cherry-pick to 5.2.x & 5.1.x** * * Add exists tests against Mina embedded server
Hmmm - I just cherry-picked this to 5.2 but while resolving conflicts in 5.1, I changed the exception to UncheckedIOException to avoid a breaking change. I will push that to the other branches as well. |
* GH-3247: Fix `SftpSession.exists` for error code Fixes #3247 When there is no path on the SFTP server, a `ChannelSftp.SSH_FX_NO_SUCH_FILE` error is returned in the thrown `SftpException`. * Fix `SftpSession.exists()` to check for the `SSH_FX_NO_SUCH_FILE` to return `false` and re-throw an exception otherwise * Add mock test for `SftpSession.exists()` * Add `org.mockito.AdditionalMatchers` to `checkstyle.xml` exclusions **Cherry-pick to 5.2.x & 5.1.x** * * Add exists tests against Mina embedded server
Fixes #3247
When there is no path on the SFTP server, a
ChannelSftp.SSH_FX_NO_SUCH_FILE
error is returned in the thrown
SftpException
.SftpSession.exists()
to check for theSSH_FX_NO_SUCH_FILE
toreturn
false
and re-throw an exception otherwiseSftpSession.exists()
org.mockito.AdditionalMatchers
tocheckstyle.xml
exclusionsCherry-pick to 5.2.x & 5.1.x