Claus Ibsen created CAMEL-25999:
-----------------------------------

             Summary: camel-toon - marshal of bytes, a stream or a file writes 
wrong TOON without an error
                 Key: CAMEL-25999
                 URL: https://issues.apache.org/jira/browse/CAMEL-25999
             Project: Camel
          Issue Type: Bug
    Affects Versions: 4.18.0, 4.22.0, 4.23.0
            Reporter: Claus Ibsen
             Fix For: 4.24.0


The toon data format encodes a String as JSON text, and any other body with 
{{JToon.encode}} ({{ToonDataFormat}}, main 50d17f9c2614, lines 90-95). JToon 
normalizes the object, so a body that holds JSON text in another form is 
written as an object, with no error:
* a {{byte[]}} is written as an array of numbers;
* a stream is written as nothing;
* a {{java.io.File}} is written as its path.

So {{from: file}} followed by {{marshal: toon}}, where the body is a 
{{GenericFile}}, does not convert the JSON of the file.

Checked on 4.24.0-SNAPSHOT with {{camel run}}, with the JSON {{\{"id":1\}}}:
* as a String: {{id: 1}};
* as a {{byte[]}}: {{[8]: 123,34,105,100,34,58,49,125}};
* as an {{InputStream}}: empty output;
* as a {{java.io.File}}: the path of the file.

*Proposed change*: read bytes, a stream or a file (WrappedFile) as JSON text in 
the charset of the exchange, as a String is.

_Claude Code on behalf of davsclaus_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to