[
https://issues.apache.org/jira/browse/CAMEL-25971?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Work on CAMEL-25971 started by Claus Ibsen.
-------------------------------------------
> camel-exec - an ExecResult without output does not convert to a byte array
> --------------------------------------------------------------------------
>
> Key: CAMEL-25971
> URL: https://issues.apache.org/jira/browse/CAMEL-25971
> Project: Camel
> Issue Type: Bug
> Components: camel-exec
> Affects Versions: 4.18.0, 4.22.0, 4.23.0
> Reporter: Claus Ibsen
> Assignee: Claus Ibsen
> Priority: Minor
> Fix For: 4.24.0
>
>
> When the command writes nothing to its standard output, the ExecResult does
> not convert to a byte array: {{ExecResultConverter.convertToByteArray}}
> passes the null stream to {{IOUtils.toByteArray}} (main e6885df7894d, line
> 55), which throws a NullPointerException. The conversion to a String gives ""
> in the same case.
> Checked on 4.24.0-SNAPSHOT with {{camel run}}: after {{to: exec:true}},
> {{convertBodyTo: byte[]}} fails with {{InvalidPayloadException: No body
> available of type: byte[] but has type:
> org.apache.camel.component.exec.ExecResult}}, caused by the error of the type
> conversion.
> *Proposed change*: return an empty byte array when there is no output, as the
> String converter does.
> _Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)