[ 
https://issues.apache.org/jira/browse/CAMEL-27914?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Claus Ibsen updated CAMEL-27914:
--------------------------------
    Description: 
Found while improving the option descriptions of camel-ftp for CAMEL-23832 
(commit 
https://github.com/apache/camel/commit/a006edf94a2c3aafc975365cc4320f8eb4096f59,
 pull request https://github.com/apache/camel/pull/31179).
These are separate problems of the component; the descriptions change only 
documents the current behavior.

h4. 1. activePortRange never takes effect
{{FtpEndpoint.createRemoteFileOperations}} calls client.setActivePortRange(min, 
max) before connecting, but in Commons Net 3.13.0 FTPClient._connectAction_() 
(from connect) and disconnect() call initDefaults(), which resets the active 
port range to 0, so the client always uses a port the OS picks. 
FromFtpActivePortRangeIT does not check the port. 
{{FtpsEndpoint.createRemoteFileOperations}} does not apply activePortRange at 
all.
Proposed change: call setActivePortRange in FtpOperations.doConnect after 
connect, and test the port.

h4. 2. jschLoggingLevel applies to every sftp endpoint
{{SftpOperations.createSession}} calls the static JSch.setLogger, so the 
endpoint that connects last sets the logger level of all JSch sessions in the 
JVM.
Proposed change: use jsch.setInstanceLogger (JSch 2.28.8).

h4. 3. sftp: connectTimeout is ignored when bindAddress is set
With bindAddress, {{SftpOperations.createSession}} creates the socket with 
session.getTimeout() as timeout, which is soTimeout (or serverAliveInterval), 
not connectTimeout; soTimeout=0 means no limit.
Proposed change: pass connectTimeout.

h4. 4. sftp: compression levels above 9 fail the connection
The old option text advertised levels up to 10; JSch rejects levels above 9 
(jzlib Deflate.deflateInit), so the session fails once zlib is negotiated.
Proposed change: validate the level as 1-9 or clamp it.

h4. 5. The read lock defaults of the remote components are wrong in the catalog
{{RemoteFileEndpoint}} sets readLockCheckInterval=5000 and 
readLockTimeout=20000 in its constructor, but the metadata of ftp, ftps, sftp, 
mina-sftp, azure-files and scp shows the GenericFileEndpoint defaults 
1000/10000. readLockMarkerFile is listed for ftp, sftp, smb and azure-files but 
their read lock strategies ignore it. maximumReconnectAttempts has no 
defaultValue (the field is 3), and it counts the total attempts, not the 
reconnects after the first.
Proposed change: give the remote endpoints their own defaults in the metadata.

h4. 6. ftpClientConfig.* parameters turn off the system type detection
With any ftpClientConfig.* parameter and no ftpClientConfig bean, FtpEndpoint 
and FtpsEndpoint create new FTPClientConfig(), which is the UNIX system type, 
so the listing parser no longer uses SYST.
Proposed change: use new FTPClientConfig("").

h4. 7. Smaller issues
jschLoggingLevel has no label. SftpComponent knownHostsFile and knownHostsUri 
are marked secret but are paths. When several of knownHostsFile, knownHosts and 
knownHostsUri are set, each setKnownHosts call replaces the previous one; the 
precedence is not documented. ftpClient.keyStore.* calls 
setNeedClientAuth(true) on the FTPS client, a server-side flag. The doc page 
and the 4.x migration page call the JSch logging option loggingLevel instead of 
jschLoggingLevel.


_Claude Code on behalf of davsclaus_

  was:
Found while improving the option descriptions of camel-ftp for CAMEL-23832 
(pull request https://github.com/apache/camel/pull/31179).
These are separate problems of the component; the descriptions change only 
documents the current behavior.

h4. 1. activePortRange never takes effect
{{FtpEndpoint.createRemoteFileOperations}} calls client.setActivePortRange(min, 
max) before connecting, but in Commons Net 3.13.0 FTPClient._connectAction_() 
(from connect) and disconnect() call initDefaults(), which resets the active 
port range to 0, so the client always uses a port the OS picks. 
FromFtpActivePortRangeIT does not check the port. 
{{FtpsEndpoint.createRemoteFileOperations}} does not apply activePortRange at 
all.
Proposed change: call setActivePortRange in FtpOperations.doConnect after 
connect, and test the port.

h4. 2. jschLoggingLevel applies to every sftp endpoint
{{SftpOperations.createSession}} calls the static JSch.setLogger, so the 
endpoint that connects last sets the logger level of all JSch sessions in the 
JVM.
Proposed change: use jsch.setInstanceLogger (JSch 2.28.8).

h4. 3. sftp: connectTimeout is ignored when bindAddress is set
With bindAddress, {{SftpOperations.createSession}} creates the socket with 
session.getTimeout() as timeout, which is soTimeout (or serverAliveInterval), 
not connectTimeout; soTimeout=0 means no limit.
Proposed change: pass connectTimeout.

h4. 4. sftp: compression levels above 9 fail the connection
The old option text advertised levels up to 10; JSch rejects levels above 9 
(jzlib Deflate.deflateInit), so the session fails once zlib is negotiated.
Proposed change: validate the level as 1-9 or clamp it.

h4. 5. The read lock defaults of the remote components are wrong in the catalog
{{RemoteFileEndpoint}} sets readLockCheckInterval=5000 and 
readLockTimeout=20000 in its constructor, but the metadata of ftp, ftps, sftp, 
mina-sftp, azure-files and scp shows the GenericFileEndpoint defaults 
1000/10000. readLockMarkerFile is listed for ftp, sftp, smb and azure-files but 
their read lock strategies ignore it. maximumReconnectAttempts has no 
defaultValue (the field is 3), and it counts the total attempts, not the 
reconnects after the first.
Proposed change: give the remote endpoints their own defaults in the metadata.

h4. 6. ftpClientConfig.* parameters turn off the system type detection
With any ftpClientConfig.* parameter and no ftpClientConfig bean, FtpEndpoint 
and FtpsEndpoint create new FTPClientConfig(), which is the UNIX system type, 
so the listing parser no longer uses SYST.
Proposed change: use new FTPClientConfig("").

h4. 7. Smaller issues
jschLoggingLevel has no label. SftpComponent knownHostsFile and knownHostsUri 
are marked secret but are paths. When several of knownHostsFile, knownHosts and 
knownHostsUri are set, each setKnownHosts call replaces the previous one; the 
precedence is not documented. ftpClient.keyStore.* calls 
setNeedClientAuth(true) on the FTPS client, a server-side flag. The doc page 
and the 4.x migration page call the JSch logging option loggingLevel instead of 
jschLoggingLevel.


_Claude Code on behalf of davsclaus_


> camel-ftp: activePortRange never applied, jschLoggingLevel is JVM-wide, sftp 
> connectTimeout ignored with bindAddress, compression=10 fails, remote 
> readLock defaults wrong in the catalog
> -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-27914
>                 URL: https://issues.apache.org/jira/browse/CAMEL-27914
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-ftp
>            Reporter: Claus Ibsen
>            Priority: Minor
>             Fix For: 4.25.0
>
>
> Found while improving the option descriptions of camel-ftp for CAMEL-23832 
> (commit 
> https://github.com/apache/camel/commit/a006edf94a2c3aafc975365cc4320f8eb4096f59,
>  pull request https://github.com/apache/camel/pull/31179).
> These are separate problems of the component; the descriptions change only 
> documents the current behavior.
> h4. 1. activePortRange never takes effect
> {{FtpEndpoint.createRemoteFileOperations}} calls 
> client.setActivePortRange(min, max) before connecting, but in Commons Net 
> 3.13.0 FTPClient._connectAction_() (from connect) and disconnect() call 
> initDefaults(), which resets the active port range to 0, so the client always 
> uses a port the OS picks. FromFtpActivePortRangeIT does not check the port. 
> {{FtpsEndpoint.createRemoteFileOperations}} does not apply activePortRange at 
> all.
> Proposed change: call setActivePortRange in FtpOperations.doConnect after 
> connect, and test the port.
> h4. 2. jschLoggingLevel applies to every sftp endpoint
> {{SftpOperations.createSession}} calls the static JSch.setLogger, so the 
> endpoint that connects last sets the logger level of all JSch sessions in the 
> JVM.
> Proposed change: use jsch.setInstanceLogger (JSch 2.28.8).
> h4. 3. sftp: connectTimeout is ignored when bindAddress is set
> With bindAddress, {{SftpOperations.createSession}} creates the socket with 
> session.getTimeout() as timeout, which is soTimeout (or serverAliveInterval), 
> not connectTimeout; soTimeout=0 means no limit.
> Proposed change: pass connectTimeout.
> h4. 4. sftp: compression levels above 9 fail the connection
> The old option text advertised levels up to 10; JSch rejects levels above 9 
> (jzlib Deflate.deflateInit), so the session fails once zlib is negotiated.
> Proposed change: validate the level as 1-9 or clamp it.
> h4. 5. The read lock defaults of the remote components are wrong in the 
> catalog
> {{RemoteFileEndpoint}} sets readLockCheckInterval=5000 and 
> readLockTimeout=20000 in its constructor, but the metadata of ftp, ftps, 
> sftp, mina-sftp, azure-files and scp shows the GenericFileEndpoint defaults 
> 1000/10000. readLockMarkerFile is listed for ftp, sftp, smb and azure-files 
> but their read lock strategies ignore it. maximumReconnectAttempts has no 
> defaultValue (the field is 3), and it counts the total attempts, not the 
> reconnects after the first.
> Proposed change: give the remote endpoints their own defaults in the metadata.
> h4. 6. ftpClientConfig.* parameters turn off the system type detection
> With any ftpClientConfig.* parameter and no ftpClientConfig bean, FtpEndpoint 
> and FtpsEndpoint create new FTPClientConfig(), which is the UNIX system type, 
> so the listing parser no longer uses SYST.
> Proposed change: use new FTPClientConfig("").
> h4. 7. Smaller issues
> jschLoggingLevel has no label. SftpComponent knownHostsFile and knownHostsUri 
> are marked secret but are paths. When several of knownHostsFile, knownHosts 
> and knownHostsUri are set, each setKnownHosts call replaces the previous one; 
> the precedence is not documented. ftpClient.keyStore.* calls 
> setNeedClientAuth(true) on the FTPS client, a server-side flag. The doc page 
> and the 4.x migration page call the JSch logging option loggingLevel instead 
> of jschLoggingLevel.
> _Claude Code on behalf of davsclaus_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to