[
https://issues.apache.org/jira/browse/CAMEL-26236?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Andrea Cosentino reassigned CAMEL-26236:
----------------------------------------
Assignee: Andrea Cosentino
> camel-ignite - with fireExistingQueryResults the cache consumer sends
> Cache.Entry bodies without the key header, and producers without an operation
> fail with a NullPointerException
> ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-26236
> URL: https://issues.apache.org/jira/browse/CAMEL-26236
> Project: Camel
> Issue Type: Bug
> Components: camel-ignite
> Reporter: Claus Ibsen
> Assignee: Andrea Cosentino
> Priority: Minor
> Fix For: 4.24.0
>
>
> Found while adding the catalog body types of the seven ignite components
> (CAMEL-24961, PR #28397).
> h4. 1. ignite-cache consumer: fireExistingQueryResults sends the wrong
> exchange
> {{IgniteCacheContinuousQueryConsumer}} (main 2a465aa4814c, lines 78-80)
> builds an exchange with the value and the {{CamelIgniteCacheKey}} header,
> then processes {{createExchange(entry)}} instead, so each existing entry
> arrives as a {{Cache.Entry}} body with no key header, unlike the events that
> follow. Checked on 4.24.0-SNAPSHOT with an embedded Ignite node.
> Proposed: process the exchange built on line 78.
> h4. 2. ignite-cache PUT of a Map: null body, and a Map cannot be stored as
> one value
> {{IgniteCacheProducer.doPut}} (lines 113-117) puts all entries of a Map body
> and returns before {{IgniteHelper.maybePropagateIncomingBody}} (line 130), so
> the body after the PUT is null whatever
> {{propagateIncomingBodyIfNoReturnValue}} says. A Map is always put as
> entries, even with the {{CamelIgniteCacheKey}} header or
> {{treatCollectionsAsCacheObjects=true}}, so a Map can never be stored as one
> value. Checked on 4.24.0-SNAPSHOT with an embedded Ignite node.
> Proposed: store the Map as one value when the key header is set or
> {{treatCollectionsAsCacheObjects}} is true, and propagate the body in both
> branches.
> h4. 3. No operation: NullPointerException (cache, idgen, queue, set)
> The operation comes from the header, else the endpoint's {{operation}}
> ({{IgniteCacheProducer}} lines 229-231, {{IgniteIdGenProducer}} lines 81-83,
> and the same in queue and set), and the producers switch on it
> ({{IgniteCacheProducer}} line 58, {{IgniteIdGenProducer}} line 49,
> {{IgniteQueueProducer}} line 54, {{IgniteSetProducer}} line 54); with neither
> set the switch throws a NullPointerException. Checked on 4.24.0-SNAPSHOT with
> an embedded Ignite node.
> Proposed: fail with a message that names the operation header and option (or
> make the option required).
> h4. 4. ignite-idgen: GET and the increments fail on a body they do not use
> {{IgniteIdGenProducer.process}} (line 47) converts the body to {{Long}}
> before the switch, so GET, GET_AND_INCREMENT and INCREMENT_AND_GET fail with
> a {{TypeConversionException}} when the body is not a number, although they
> ignore it. ADD_AND_GET with no body (line 52) fails with a
> NullPointerException on unboxing. Checked on 4.24.0-SNAPSHOT with an embedded
> Ignite node.
> Proposed: convert the body only in ADD_AND_GET and GET_AND_ADD, and fail with
> a clear message when it is missing.
> h4. 5. ignite-compute: null body and the error messages
> {{IgniteComputeProducer}} calls {{job.getClass()}} on the body (CALL line
> 110, RUN line 179, and in BROADCAST and EXECUTE), so a null body fails with a
> NullPointerException. The APPLY, AFFINITY_CALL and AFFINITY_RUN errors (lines
> 207, 235, 251) call {{getBody().getClass()}} while building the message, so
> the error itself throws a NullPointerException when the body is null. RUN and
> AFFINITY_RUN have no result, and {{IgniteInCamelClosure}} (line 291) sets the
> null result as the body whatever {{propagateIncomingBodyIfNoReturnValue}}
> says. Checked on 4.24.0-SNAPSHOT with an embedded Ignite node.
> Proposed: fail with a clear message for a null body, and keep the incoming
> body for RUN and AFFINITY_RUN when {{propagateIncomingBodyIfNoReturnValue}}
> is true.
> h4. 6. ignite-queue and ignite-set: ADD, CONTAINS, REMOVE and RETAIN_ALL with
> no body
> {{IgniteQueueProducer}} and {{IgniteSetProducer}} call {{body.getClass()}}
> (line 57 and the CONTAINS, REMOVE and RETAIN_ALL cases), so a null body fails
> with a NullPointerException. Checked on 4.24.0-SNAPSHOT with an embedded
> Ignite node.
> Proposed: fail with a message that the operation needs a body.
> _Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)