Claus Ibsen created CAMEL-26172:
-----------------------------------
Summary: camel-splunk-hec - a stream body sends a truncated
invalid JSON request, and bytes are sent as base64 and a File as its path
Key: CAMEL-26172
URL: https://issues.apache.org/jira/browse/CAMEL-26172
Project: Camel
Issue Type: Bug
Components: camel-splunk-hec
Reporter: Claus Ibsen
Fix For: 4.24.0
Found while adding the catalog body types of splunk-hec (CAMEL-24961, PR
#28412).
h4. 1. A stream body sends a truncated, invalid JSON request to Splunk
{{SplunkHECProducer.process}} (main 2a465aa4814c, lines 105-106) writes the
payload with Jackson inside an {{EntityTemplate}}, that is while the request is
already being sent. With an {{InputStream}} body Jackson fails half way, the
exchange fails, but a truncated, invalid JSON request has already reached the
server. Checked on 4.24.0-SNAPSHOT with a local HTTP server as the HEC endpoint.
Proposed: serialize the payload to a byte array before sending, so a
serialization failure happens before any request is made (and convert stream
bodies to text, see 2).
h4. 2. A byte array is sent as base64 and a File as its path
{{SplunkHECProducer.createPayload}} (main 2a465aa4814c, line 134) puts
{{message.getBody()}} as is in the event, so Jackson writes a {{byte[]}} body
as a base64 string and a {{java.io.File}} as its path, with no error. Checked
on 4.24.0-SNAPSHOT with the local HTTP server.
Proposed: convert byte array, stream and file bodies to text before putting
them in the event.
_Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)