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

Claus Ibsen reassigned CAMEL-26022:
-----------------------------------

    Assignee: Claus Ibsen

> camel-ssh - the shell channel without a shellPrompt fails with a 
> NullPointerException
> -------------------------------------------------------------------------------------
>
>                 Key: CAMEL-26022
>                 URL: https://issues.apache.org/jira/browse/CAMEL-26022
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-ssh
>    Affects Versions: 4.18.0, 4.22.0, 4.23.0
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>            Priority: Minor
>             Fix For: 4.24.0
>
>
> Found while checking the body types of the ssh component for the catalog 
> (CAMEL-24961).
> h4. 1. The shell channel without a shellPrompt fails with a 
> NullPointerException
> With {{channelType=shell}} and no {{shellPrompt}}, the producer fails with 
> {{NullPointerException: Cannot invoke "String.length()" because "suffix" is 
> null}}, from {{endsWith(endpoint.getShellPrompt())}} ({{SshHelper}}, main 
> 07d2e7a987bc, line 230).
> Checked on 4.24.0-SNAPSHOT with {{camel run}} against an embedded Apache MINA 
> SSHD server: {{ssh:localhost:2222?...&channelType=shell}} gave "Cannot 
> execute command: echo shell", caused by that NullPointerException.
> *Proposed change*: fail when the endpoint starts, with a message that the 
> shell channel needs a shellPrompt.
> h4. Also read in the code, not run
> * The catalog says {{sleepForShellPrompt}} is 100 by default, but the field 
> is 0 ({{SshConfiguration}}, lines 74-75), so the shell loop calls 
> {{Thread.sleep(0)}} and spins ({{SshHelper}}, line 236), with no timeout when 
> the prompt never comes.
> * The deprecated {{SshResult.STDERR}} is {{SshConstants.EXIT_VALUE}} 
> ({{SshResult}}, line 24); it was "CamelSshStderr" before CAMEL-17792.
> * A command that does not end blocks the thread: {{channel.waitFor(..., 0)}} 
> has no timeout ({{SshHelper}}, line 193); the {{timeout}} option covers the 
> connection, the authentication and the opening of the channel only.
> _Claude Code on behalf of davsclaus_



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

Reply via email to