gnodet opened a new pull request, #30709: URL: https://github.com/apache/camel/pull/30709
## Summary Fixes [CAMEL-27031](https://issues.apache.org/jira/browse/CAMEL-27031): when the SFTP server rejects credentials, `MinaSftpOperations` retried the connection `maximumReconnectAttempts` times (default 3), sending the wrong password to the server on each attempt. ## Root cause `tryConnect()` caught all `IOException` generically and signalled the reconnect loop to retry. However, `session.auth().verify()` throws `org.apache.sshd.common.SshException` ("No more authentication methods available") when the server definitively rejects the credentials — and `SshException extends IOException`. That exception was being swallowed into the retry path. ## Fix Catch `SshException` **before** the generic `IOException` handler. When the message indicates an authentication failure, rethrow immediately as `GenericFileOperationFailedException`, bypassing the reconnect loop. `SshException` from connection failures (thrown by `ConnectFuture`) carries a different message and continues to fall through to the existing retry path. ```java } catch (SshException e) { String msg = e.getMessage(); if (msg != null && (msg.contains("No more authentication methods available") || msg.contains("Authentication failed"))) { throw new GenericFileOperationFailedException( "Login rejected by " + payload.configuration.remoteServerInformation() + ": " + msg, e); } payload.exception = e; return false; } catch (IOException e) { payload.exception = e; return false; } ``` ## Tests `MinaSftpAuthRetryIT` (new): - `testRejectedLoginIsNotRetried` — starts an embedded SSHD server that always rejects passwords; verifies that `GenericFileOperationFailedException` is thrown immediately (not after N retries) with a "Login rejected" message, and that the authenticator is called at most twice per attempt (once per auth method: password + keyboard-interactive). - `testTransientFailureIsStillRetried` — verifies that plain connection failures (server stopped) still go through the retry loop and produce "Cannot connect to …". --- _Hermès on behalf of gnodet_ -- 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]
