Claus Ibsen created CAMEL-26134:
-----------------------------------
Summary: camel-test-citrus - a byte[] body is compared as [123,
34, ...] so it never validates, a File as its path, and a plain InputStream is
consumed
Key: CAMEL-26134
URL: https://issues.apache.org/jira/browse/CAMEL-26134
Project: Camel
Issue Type: Bug
Components: camel-test
Reporter: Claus Ibsen
Fix For: 4.24.0
Found while adding the catalog body types of mapstruct, robotframework, citrus
and spring-event (CAMEL-24961, PR #28417).
h4. 1. A byte[] body never validates
{{CitrusValidationProcessor.buildReceivedMessage}} (main 2a465aa4814c, lines
95-101) converts only a {{StreamCache}} body to a String; any other body is
handed to Citrus as is, and a {{byte[]}} is compared as {{Arrays.toString}}
({{[123, 34, ...]}}), so JSON or text sent as bytes never validates. Checked on
4.24.0-SNAPSHOT in-process.
Proposed: convert byte[] (and other text-like bodies) to a String before the
validation.
h4. 2. A File body is compared as its path
A {{java.io.File}} body is compared as its {{toString}}, the path, not its
content (same place). Checked on 4.24.0-SNAPSHOT in-process.
Proposed: read File and Path bodies as text.
h4. 3. A plain InputStream is consumed and not reset
Without stream caching, a plain {{InputStream}} body is read by the validation
and not reset (same place), so the next step gets an empty stream. Checked on
4.24.0-SNAPSHOT in-process.
Proposed: convert the body to a String and set it back on the message (or to a
StreamCache) before validating.
_Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)