Claus Ibsen created CAMEL-26059:
-----------------------------------

             Summary: camel-jsch - scp fails with a NullPointerException 
without a known hosts file
                 Key: CAMEL-26059
                 URL: https://issues.apache.org/jira/browse/CAMEL-26059
             Project: Camel
          Issue Type: Bug
          Components: camel-jsch
    Affects Versions: 4.18.0, 4.22.0, 4.23.0
            Reporter: Claus Ibsen
             Fix For: 4.24.0


Found while adding the catalog body types of scp (CAMEL-24961), checked with 
{{camel run}} against an Apache MINA SSHD server with scp.

h4. 1. useUserKnownHostsFile=false without a knownHostsFile fails with a 
NullPointerException

{{ScpOperations}} calls {{jsch.setKnownHosts((String) null)}} then 
({{ScpOperations}}, main 5aac7df76b83, line 384), which fails in JSch with 
{{NullPointerException: Cannot invoke "String.startsWith(String)" because "str" 
is null}}. Checked on 4.24.0-SNAPSHOT with {{camel run}}.

*Proposed change*: skip the known hosts in that case (strictHostKeyChecking is 
no by default), or fail with a message that says to set knownHostsFile.

h4. 2. The remote directory must exist

scp has no mkdir: when the directory of the endpoint does not exist, each 
upload is written to a file named like the directory, and the last one wins. 
Checked on 4.24.0-SNAPSHOT with {{camel run}}: with 
{{scp:localhost:2223/upload}} and no upload directory, every upload went to a 
file named upload. The docs do not say the directory must exist.

*Proposed change*: say it in the docs, or create the directory.

h4. Also read in the code, not run

* The whole body is read into memory to send its size, an int 
({{buffer.mark(Integer.MAX_VALUE)}}, line 482), so a body over 2 GiB cannot be 
sent.
* checksumFileAlgorithm writes no usable checksum file: {{storeFileDirectly}} 
(line 164) does not run an scp command.

_Claude Code on behalf of davsclaus_



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

Reply via email to