[
https://issues.apache.org/jira/browse/CAMEL-26154?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Claus Ibsen reassigned CAMEL-26154:
-----------------------------------
Assignee: Claus Ibsen
> camel-iggy - the producer turns a byte[] body into a String and corrupts
> binary data, and the consumer decodes with the platform charset
> ----------------------------------------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-26154
> URL: https://issues.apache.org/jira/browse/CAMEL-26154
> Project: Camel
> Issue Type: Bug
> Reporter: Claus Ibsen
> Assignee: Claus Ibsen
> Priority: Major
> Fix For: 4.24.0
>
>
> Found while adding the catalog body types of rocketmq, hivemq, iggy and
> kafka-share (CAMEL-24961, PR #28394).
> h4. 1. The producer corrupts binary bodies
> {{IggyProducer.process}} (main 2a465aa4814c, line 102) converts every body
> that is not a {{List}} or an Iggy {{Message}} to a {{String}} and sends
> {{Message.of(String)}}. A {{byte[]}} that is not valid UTF-8 is corrupted:
> the bytes {{ff fe 00 41}} are stored as {{EF BF BD EF BF BD 00 41}}. Checked
> on 4.24.0-SNAPSHOT with iggy 0.9.0 in Docker.
> Proposed: send {{byte[]}} (and streams, files) as bytes with
> {{Message.of(MessageHeader, byte[], ...)}}, and convert only other bodies to
> text.
> h4. 2. The consumer decodes the payload with the platform charset
> {{IggyFetchRecords}} (line 191) sets the body to {{new
> String(message.payload())}}, which uses the JVM default charset (the line has
> a {{TODO is it ok?}}). Text sent as UTF-8 is read wrong on a JVM with another
> default charset, and binary payloads cannot be read back. Read in the code,
> not run.
> Proposed: give the payload as {{byte[]}} (or decode as UTF-8, or by a charset
> option).
> h4. 3. No body fails with a NullPointerException
> With a null body, {{IggyProducer.process}} (line 102) calls
> {{Message.of(null)}}, which throws a {{NullPointerException}} inside the Iggy
> client. Checked on 4.24.0-SNAPSHOT with iggy 0.9.0.
> Proposed: fail with a clear message (or send an empty payload) when there is
> no body.
> h4. 4. An empty List fails with an unclear error
> An empty {{List}} body (line 85) passes {{isListOfStrings}} and is sent as an
> empty batch and fails with {{Cannot encode an empty message batch}} from the
> client. Checked on 4.24.0-SNAPSHOT with iggy 0.9.0.
> Proposed: skip the send for an empty List, or fail with a message that says
> the List is empty.
> h4. 5. camel-test-infra-iggy cannot start the 0.9.0 image
> {{IggyContainer}} (test-infra/camel-test-infra-iggy, line 43) sets only the
> root user, password and TCP address. The {{mirror.gcr.io/apache/iggy:0.9.0}}
> image of {{container.properties}} also needs {{IGGY_NODE_ADVERTISED_ADDRESS}}
> and {{IGGY_SHARDING_CPU_ALLOCATION}} to start. Checked on 4.24.0-SNAPSHOT
> with iggy 0.9.0 in Docker: the container does not start without them.
> Proposed: set both environment variables in {{IggyContainer}}.
> _Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)