Claus Ibsen created CAMEL-25958:
-----------------------------------

             Summary: camel-aws2-kinesis - a Path body is sent as a batch and 
fails, and a body that does not convert to bytes fails with a 
NullPointerException
                 Key: CAMEL-25958
                 URL: https://issues.apache.org/jira/browse/CAMEL-25958
             Project: Camel
          Issue Type: Bug
          Components: camel-aws2-kinesis
    Affects Versions: 4.18.0, 4.22.0, 4.23.0
            Reporter: Claus Ibsen
             Fix For: 4.24.0


The aws2-kinesis producer sends a body that is an Iterable as a batch, one 
record per element ({{Kinesis2Producer.process}}, main e6885df7894d, line 69). 
A {{java.nio.file.Path}} is an Iterable of its name elements, so a Path body 
goes to the batch and fails with {{IllegalArgumentException: Record type not 
supported. Must be byte[], ByteBuffer, InputStream or UTF-8 String}} (line 
125), while a {{java.io.File}} body converts to the content of the file.

A single record takes the body with {{getBody(byte[].class)}} and passes it to 
{{SdkBytes.fromByteArray}} (lines 163 and 168). A body that does not convert to 
a byte[], such as a Map, gives null, and the producer fails with 
{{NullPointerException: bytes must not be null.}} instead of an error that 
names the type of the body.

Checked on 4.24.0-SNAPSHOT against LocalStack ({{camel infra run aws}}).

*Proposed change*: send a Path as a single record, and read the body with 
{{getMandatoryBody(byte[].class)}}, which fails with an InvalidPayloadException 
that names the type.

_Claude Code on behalf of davsclaus_



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

Reply via email to