Claus Ibsen created CAMEL-26186:
-----------------------------------
Summary: camel-thrift - a consumer reply that does not convert to
the return type sends a null result with no error, and a null reply for an i32
method sends 0
Key: CAMEL-26186
URL: https://issues.apache.org/jira/browse/CAMEL-26186
Project: Camel
Issue Type: Bug
Reporter: Claus Ibsen
Fix For: 4.24.0
Found while adding the catalog body types of thrift (CAMEL-24961, PR #28413).
h4. 1. The async consumer sends a null result when the reply does not convert
{{ThriftMethodHandler}} (main 2a465aa4814c, line 79) completes the async call
with {{callback.onComplete(message.getBody(returnType))}}: a reply that does
not convert to the return type is sent as null, with no error on either side. A
Map reply for an i32 {{add}} gives the client a null result; a null, String or
Map reply for a struct {{echo}} gives the client "echo failed: unknown result".
The sync server path (line 96 to 102) raises "Return type requires not empty
body" for the same case. Checked on 4.24.0-SNAPSHOT with an embedded Thrift
server with a Camel consumer on localhost, async and sync.
Proposed: use a mandatory conversion and complete with {{callback.onError}}
when the reply is null or does not convert (except for void methods), as the
sync path does.
h4. 2. The sync consumer sends 0 for a null reply of an i32 method
With the sync server, a route that leaves a null body for a method that returns
i32 makes the client get 0 instead of an error ({{ThriftMethodHandler}} line 96
to 102). Checked on 4.24.0-SNAPSHOT with the embedded sync Thrift server.
Proposed: fail the call with a TApplicationException when the reply is null for
a method with a return type, primitive return types included.
h4. 3. The producer matches a single non-List argument by its exact class
{{ThriftUtils.convertObjects2Primitives}} (line 313 to 318) maps the argument
types of a List body to primitives ({{Integer}} to {{int}} and so on), but for
a single non-List body it uses {{request.getClass()}}. A single Integer body
for a method with one i32 argument then finds no method ("Thrift service client
method not found"). Read in the code, not run.
Proposed: map the single argument with the same primitive and interface rules
as the List case.
_Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)