This is an automated email from the ASF dual-hosted git repository.

apupier pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new ec1b78352abe Remove usage of deprecated method in ftp component
ec1b78352abe is described below

commit ec1b78352abe942d97c3b37e79dc60daf17813ca
Author: AurĂ©lien Pupier <[email protected]>
AuthorDate: Wed Feb 11 13:36:14 2026 +0100

    Remove usage of deprecated method in ftp component
    
    it was reported as warning in the build:
    [WARNING]
    
/home/apupier/git/camel/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/CamelFTPParserFactory.java:[87,58]
    newInstance() in java.lang.Class has been deprecated
    [WARNING]
    
/home/apupier/git/camel/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpEndpoint.java:[210,19]
    setDataTimeout(int) in org.apache.commons.net.ftp.FTPClient has been
    deprecated
    [WARNING]
    
/home/apupier/git/camel/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpsEndpoint.java:[221,19]
    setDataTimeout(int) in org.apache.commons.net.ftp.FTPClient has been
    deprecated
    
    Signed-off-by: AurĂ©lien Pupier <[email protected]>
---
 .../org/apache/camel/component/file/remote/CamelFTPParserFactory.java  | 2 +-
 .../main/java/org/apache/camel/component/file/remote/FtpEndpoint.java  | 3 ++-
 .../main/java/org/apache/camel/component/file/remote/FtpsEndpoint.java | 3 ++-
 3 files changed, 5 insertions(+), 3 deletions(-)

diff --git 
a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/CamelFTPParserFactory.java
 
b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/CamelFTPParserFactory.java
index 2d4b474becc2..c80d448627a4 100644
--- 
a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/CamelFTPParserFactory.java
+++ 
b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/CamelFTPParserFactory.java
@@ -84,7 +84,7 @@ public class CamelFTPParserFactory extends 
DefaultFTPFileEntryParserFactory {
         if (JAVA_QUALIFIED_NAME_PATTERN.matcher(key).matches()) {
             Class<?> parserClass = ocr.resolveClass(key);
             try {
-                parser = (FTPFileEntryParser) parserClass.newInstance();
+                parser = (FTPFileEntryParser) 
parserClass.getDeclaredConstructor().newInstance();
             } catch (ClassCastException e) {
                 throw new ParserInitializationException(
                         parserClass.getName() + " does not implement the 
interface "
diff --git 
a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpEndpoint.java
 
b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpEndpoint.java
index b925c235dc00..6c0d8bae52b8 100644
--- 
a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpEndpoint.java
+++ 
b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpEndpoint.java
@@ -16,6 +16,7 @@
  */
 package org.apache.camel.component.file.remote;
 
+import java.time.Duration;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -207,7 +208,7 @@ public class FtpEndpoint<T extends FTPFile> extends 
RemoteFileEndpoint<FTPFile>
         }
 
         if (dataTimeout > 0) {
-            client.setDataTimeout(dataTimeout);
+            client.setDataTimeout(Duration.ofMillis(dataTimeout));
         }
 
         if (LOG.isDebugEnabled()) {
diff --git 
a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpsEndpoint.java
 
b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpsEndpoint.java
index 9523e2141a68..7223f29c5a7b 100644
--- 
a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpsEndpoint.java
+++ 
b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpsEndpoint.java
@@ -19,6 +19,7 @@ package org.apache.camel.component.file.remote;
 import java.io.File;
 import java.io.FileInputStream;
 import java.security.KeyStore;
+import java.time.Duration;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -218,7 +219,7 @@ public class FtpsEndpoint extends FtpEndpoint<FTPFile> {
         }
 
         if (dataTimeout > 0) {
-            client.setDataTimeout(dataTimeout);
+            client.setDataTimeout(Duration.ofMillis(dataTimeout));
         }
 
         if (LOG.isDebugEnabled()) {

Reply via email to