Claus Ibsen created CAMEL-26252:
-----------------------------------
Summary: camel-google-functions - a failed callFunction gives an
empty body and no exception, and callFunction without a body fails with a
NullPointerException
Key: CAMEL-26252
URL: https://issues.apache.org/jira/browse/CAMEL-26252
Project: Camel
Issue Type: Bug
Components: camel-google-functions
Reporter: Claus Ibsen
Fix For: 4.24.0
Found while adding the catalog body types of google-functions (CAMEL-24961, PR
#28404).
h4. 1. A failed call gives an empty body and no exception
{{GoogleCloudFunctionsProducer.callFunction}} (main 2a465aa4814c, line 139)
sets {{response.getResult()}} as the body and never looks at
{{response.getError()}}, so a function that fails gives an empty String and the
route goes on as a success. Checked on 4.24.0-SNAPSHOT with an in-process gRPC
mock.
Proposed: throw an exception when {{CallFunctionResponse.getError()}} is set.
h4. 2. callFunction without a body fails with a bare NullPointerException
Line 133 calls {{setData(data)}} with {{getBody(String.class)}}, and protobuf
rejects null with a NullPointerException without a message. Checked on
4.24.0-SNAPSHOT with the mock.
Proposed: send an empty data string (or fail with a clear message) when there
is no body.
h4. 3. A Map or POJO body is sent as its toString
Line 130 reads the body as String, so a Map or POJO is sent as {{{key=value}}}
instead of JSON. Checked on 4.24.0-SNAPSHOT with the mock.
Proposed: serialize a Map or POJO body to JSON.
_Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)