Claus Ibsen created CAMEL-27819:
-----------------------------------

             Summary: camel-exec: exitValues with spaces fails, a timed-out 
command looks like a normal exit
                 Key: CAMEL-27819
                 URL: https://issues.apache.org/jira/browse/CAMEL-27819
             Project: Camel
          Issue Type: Bug
          Components: camel-exec
            Reporter: Claus Ibsen
             Fix For: 4.25.0


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

h4. 1. exitValues with spaces fails
{{ExecParseUtils.splitCommaSeparatedToListOfInts}} does not trim, so 
exitValues="0, 1" (or the header) throws NumberFormatException.
Proposed change: trim each value.

h4. 2. A timed-out command looks like a normal completion
{{DefaultExecCommandExecutor}} never checks 
{{ExecuteWatchdog.killedProcess()}}. On timeout Commons Exec destroys the 
process and the exit value (for example 143) is the only sign; with exitValues 
unset the exchange continues.
Proposed change: set a header such as CamelExecTimedOut, or fail when the 
process was killed (upgrade-guide entry).

h4. 3. The timeout header is not validated
The setters reject a timeout <= 0, but CamelExecCommandTimeout goes straight to 
new ExecuteWatchdog(long): -1 means no timeout, 0 or below -1 throw 
IllegalArgumentException ("Timeout must be positive.").
Proposed change: validate the header as the option.

h4. 4. ERROR log for allowed exit values
{{ExecProducer.process}} logs at ERROR for every non-zero exit value, also when 
exitValues lists it.
Proposed change: log at ERROR only for values not in exitValues.


_Claude Code on behalf of davsclaus_



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

Reply via email to