[
https://issues.apache.org/jira/browse/CAMEL-26174?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18136863#comment-18136863
]
Claus Ibsen commented on CAMEL-26174:
-------------------------------------
PR: https://github.com/apache/camel/pull/28999
Fixes all three: key_names as a String (one name or comma separated), any
Number as sequence, and an empty response body now gives the code, status and
headers (an empty error response now fails with a StitchException). Also fixed:
a message without a sequence got the class load time, the same for every
message; it now gets the time it is built.
_Claude Code on behalf of Claus Ibsen (davsclaus)_
> camel-stitch - a request Map with key_names as a String fails with
> ClassCastException, and an Integer sequence fails the Long cast
> ----------------------------------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-26174
> URL: https://issues.apache.org/jira/browse/CAMEL-26174
> Project: Camel
> Issue Type: Bug
> Reporter: Claus Ibsen
> Assignee: Claus Ibsen
> Priority: Minor
> Fix For: 4.24.0
>
>
> Found while adding the catalog body types of stitch (CAMEL-24961, PR #28412).
> h4. 1. A request Map with key_names as a String fails with ClassCastException
> {{StitchRequestBody.fromMap}} (main 2a465aa4814c, line 80) casts
> {{key_names}} to a {{Collection}}, so a Map body with {{"key_names": "id"}}
> fails with a ClassCastException. Both Map examples in the doc did this (fixed
> in the PR to use a List). Checked on 4.24.0-SNAPSHOT with a JDK HTTP server
> behind {{StitchClientImpl}}.
> Proposed: accept a String (one key name, or comma separated names) as well as
> a Collection.
> h4. 2. A message Map with an Integer sequence fails with "Cannot cast Integer
> to Long"
> {{StitchMessage.fromMap}} (main 2a465aa4814c, line 58) casts {{sequence}} to
> {{Long}}. A Map read from JSON or YAML, or written in Groovy, has a small
> number as an {{Integer}}, so it fails with "Cannot cast java.lang.Integer to
> java.lang.Long". Checked on 4.24.0-SNAPSHOT with the local server.
> Proposed: accept any {{Number}} and use {{longValue()}}.
> h4. 3. A 200 response with an empty body leaves the input body and sets no
> headers
> {{StitchClientImpl.generateStitchResponse}} (main 2a465aa4814c, line 87) maps
> {{bufMono.asString()}}, which emits nothing for an empty body, so no
> {{StitchResponse}} is produced and {{StitchProducer.setDataOnExchange}} (line
> 64) never runs: the exchange completes with the request body unchanged and
> without the {{CamelStitchCode}}, {{CamelStitchStatus}} and
> {{CamelStitchHeaders}} headers. Checked on 4.24.0-SNAPSHOT with the local
> server.
> Proposed: emit a response with an empty message when the body is empty (for
> example {{defaultIfEmpty}}), so the code and headers are set.
> _Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)