Croway opened a new pull request, #30286:
URL: https://github.com/apache/camel/pull/30286

   JIRA: [CAMEL-27118](https://issues.apache.org/jira/browse/CAMEL-27118)
   
   - When the SFTP server refused a request, the 
`GenericFileOperationFailedException` of `sftp` only said `Cannot change 
directory to: inbox`, `Cannot list directory: ...`, `Cannot store file: ...`: 
the status was only in the `SftpException` cause, and `getCode()` was `0`. 
`SftpOperations` now builds these exceptions with one helper: the message ends 
with the status (`... : SSH_FX_NO_SUCH_FILE: No such file`), and `getCode()` / 
`getReason()` return the SFTP status code and its text, as `FtpOperations` does 
with the FTP reply. A new `GenericFileOperationFailedException(message, code, 
reason, cause)` constructor keeps the message as given. The cause is unchanged, 
so `isTransportError` and `ignoreFileNotFoundOrPermissionError` work as before.
   - A failed change to a relative directory now also gives the current 
directory, with `sftp` (`channel.pwd()`, which JSch keeps locally) and 
`ftp`/`ftps` (one `PWD`, sent only after a refused `CWD`, with the reply code 
and text read before it): `... . The path is relative to the current directory: 
/home/admin`.
   - `preferredAuthentications` was passed to JSch as is. JSch compares the 
names with the lower-case names the server offers, so `Password` or `publickey, 
password` skipped the method without a log, and the login failed with `Auth 
fail`. The names are now trimmed and lower-cased, and `SftpEndpoint` logs a 
WARN at start-up for a name JSch does not know.
   - Docs: sftp-component.adoc (new "Operation errors" section, 
`preferredAuthentications` in the connection errors table), ftp-component.adoc 
(the change-of-directory message).
   
   Tests: `SftpOperationFailureMessageIT` (8) and 
`FtpChangeDirectoryFailureMessageIT` (3). On main 9 fail (no status, code `0`, 
no current directory, `Password` fails with `Auth fail`, no WARN); the two 
upload controls pass. With the fix all 11 pass. All camel-ftp tests pass (243 
unit tests, 529 integration tests), and the 47 camel-file tests.
   
   Upgrade guide: entry "camel-ftp - sftp failures give the status of the 
server, and preferredAuthentications is not case-sensitive" (messages start as 
before, except the failed attributes check; `getCode()` is no longer `0`).
   
   _Claude Code on behalf of Federico Mariani_
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to