davsclaus opened a new pull request, #30457: URL: https://github.com/apache/camel/pull/30457
[CAMEL-27263](https://issues.apache.org/jira/browse/CAMEL-27263) `FtpsEndpoint` builds the key store and the trust store of the FTPS client from the multi-value options `ftpClient.keyStore.*` and `ftpClient.trustStore.*`. When any of them was set, it read `file` and called `toCharArray()` on the passwords. Three cases failed with a `NullPointerException`: - an option without `file`: only `type`, or only `password`; - a trust store without `password`, although a JKS trust store or a password-less store can be read without one; - a key store without `keyPassword`, although the key is usually protected with the store's password. Found with the camel-kamelets `ftps-source` and `ftps-sink`, which now expose a trust store (apache/camel-kamelets#3292). ### The change - **Without `file`:** an `IllegalArgumentException` that names `ftpClient.trustStore.file` or `ftpClient.keyStore.file` and lists the options that were set. - **Without `password`:** the store is loaded without one. A trust store that then has no certificates fails with a message to set `ftpClient.trustStore.password`. That's the case of a PKCS12 file, which protects its certificates with its password. - **Without `keyPassword`:** the key store's password is used. - Loading is done in one helper, `loadStore`, for both stores. Configurations that worked before work the same. ### Tests `FtpsEndpointTrustManagerTest` has 5 new tests: - a JKS trust store without a password trusts the server certificate; - trust store options without `file` fail with the clear message; - key store options without `file` fail with the clear message; - a key store without `keyPassword` uses the store's password; - a PKCS12 trust store without its password fails with the message to set it. All 5 fail on main: 4 with a `NullPointerException` where the clear error is expected, 1 because the NPE is thrown. camel-ftp: 284 unit tests pass (9 skipped). _Claude Code on behalf of Claus Ibsen_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_016Y4dDmBDsSWV117kccuNf9 -- 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]
