[
https://issues.apache.org/jira/browse/CAMEL-26189?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18136890#comment-18136890
]
Claus Ibsen commented on CAMEL-26189:
-------------------------------------
PR: https://github.com/apache/camel/pull/29017
1. A non-null body is converted with getMandatoryBody(byte[].class): a Map,
number or POJO body now fails with an InvalidPayloadException. A null body is
still skipped.
2. A List body now fails with an InvalidPayloadException that names
java.util.ArrayList (the TypeConversionException is the cause). The core causes
are not changed in this PR: ArrayTypeConverter throws on Array.set instead of
returning no conversion, and
CoreTypeConverterRegistry.createTypeConversionException builds the exception
from the logged value, so its "from type" is always java.lang.String. Both
affect every component and fit a separate camel-core issue.
3. raftId, channelProperties, raftHandle and stateMachine have @UriParam on the
endpoint (catalog, doc and endpoint DSL regenerated).
4. The doc says the body is converted to byte[].
Upgrade guide 4.24 has an entry for the new failure.
_Claude Code on behalf of Claus Ibsen (davsclaus)_
> camel-jgroups-raft - the producer silently skips a Map, Integer or POJO body,
> and raftId and channelProperties are missing as endpoint options in the
> catalog
> -------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-26189
> URL: https://issues.apache.org/jira/browse/CAMEL-26189
> Project: Camel
> Issue Type: Bug
> Components: camel-jgroups
> Reporter: Claus Ibsen
> Assignee: Claus Ibsen
> Priority: Minor
> Fix For: 4.24.0
>
>
> Found while adding the catalog body types of jgroups and jgroups-raft
> (CAMEL-24961, PR #28413).
> h4. 1. A body that does not convert to byte[] is silently skipped
> {{JGroupsRaftProducer.process}} (main 2a465aa4814c, line 60) reads the body
> with the non-mandatory {{getBody(byte[].class)}}; for a Map, an Integer or a
> POJO it is null and the producer only logs "Body is null, cannot call set
> method on raftHandle." at DEBUG (line 84): nothing is replicated and the
> exchange succeeds. Checked on 4.24.0-SNAPSHOT with local jgroups-raft
> channels (raftABC.xml, InMemoryLog).
> Proposed: use a mandatory conversion to byte[] for a non-null body, so an
> unsupported body fails the exchange.
> h4. 2. A List body fails with a misleading TypeConversionException
> A List body fails with a TypeConversionException about converting a String to
> byte[] ("argument type mismatch"), which does not say that the List cannot be
> converted. This likely comes from the core array conversion rather than the
> component. Checked on 4.24.0-SNAPSHOT with the same local channels.
> Proposed: check where the List to byte[] conversion goes wrong, and give an
> error that names the List body.
> h4. 3. raftId and channelProperties work as endpoint options but are not in
> the catalog
> {{JGroupsRaftEndpoint}} (line 51 to 52) has the fields {{raftId}} and
> {{channelProperties}} with setters (line 185 and 193) but no {{@UriParam}},
> so {{jgroups-raft:cluster?raftId=A&channelProperties=raft.xml}} works but the
> catalog and the doc list them only as component options. Checked on
> 4.24.0-SNAPSHOT with endpoint query parameters on local channels.
> Proposed: add {{@UriParam}} with a description to both fields (and
> regenerate).
> h4. 4. The doc says the producer body must be a byte[]
> The component doc (jgroups-raft-component.adoc, line 89) says the body "must
> be a {{byte[]}}", but text, stream and File bodies are converted and work.
> Proposed: say that the body is converted to byte[] (text, bytes, stream or
> file).
> _Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)