davsclaus commented on code in PR #30457:
URL: https://github.com/apache/camel/pull/30457#discussion_r4639165898
##########
components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpsEndpoint.java:
##########
@@ -191,6 +190,37 @@ protected FTPClient createFtpClient() throws Exception {
return client;
}
+ /**
+ * The file option of the key store or trust store options, which the
other options need.
+ */
+ private static String storeFile(Map<String, Object> parameters, String
prefix) {
+ Object file = parameters.get("file");
+ if (file == null) {
+ throw new IllegalArgumentException(
+ prefix + "file must be set when other " + prefix + "*
options are set: " + parameters.keySet());
+ }
+ return file.toString();
+ }
+
+ /**
+ * Loads a key store or trust store file. Without a password the store is
loaded without one, as a store without a
+ * password, or a JKS trust store, can be read.
+ */
+ private static KeyStore loadStore(String type, String file, String
password, String name) throws Exception {
+ KeyStore store = KeyStore.getInstance(type);
+ FileInputStream is = new FileInputStream(new File(file));
+ try {
+ store.load(is, toChars(password));
+ } finally {
+ IOHelper.close(is, name, LOG);
+ }
Review Comment:
Done in b1050359ec4e: `loadStore` now uses try-with-resources, and the
unused `IOHelper` import and `name` parameter are gone.
`FtpsEndpointTrustManagerTest` passes (9 tests).
_Claude Code on behalf of Claus Ibsen_
--
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]