GH-3247: Fix SftpSession.exists for error code (#3248)

* GH-3247: Fix `SftpSession.exists` for error code

Fixes https://github.com/spring-projects/spring-integration/issues/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
This commit is contained in:
Artem Bilan
2020-04-14 15:26:14 -04:00
committed by GitHub
parent 97702ae712
commit b75f1bd0da
4 changed files with 85 additions and 21 deletions

View File

@@ -84,6 +84,7 @@
org.mockito.BDDMockito.*,
org.mockito.AdditionalAnswers.*,
org.mockito.ArgumentMatchers.*,
org.mockito.AdditionalMatchers.*,
org.springframework.integration.gemfire.config.xml.ParserTestUtil.*,
org.springframework.integration.test.mock.MockIntegration.*,
org.springframework.integration.test.util.TestUtils.*,