[ 
https://issues.apache.org/jira/browse/CAMEL-8797?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14560606#comment-14560606
 ] 

Calle Kabo commented on CAMEL-8797:
-----------------------------------

Sorry, I'm back again...
I made this test:
{code}
            <setBody>
                <simple resultType="byte[]">this is the new body</simple>
            </setBody>
            <log message="RECEIVED2, body length = '${in.body.length}'" 
loggingLevel="DEBUG"/>
            <log message="RECEIVED2, body = '${in.body}'" loggingLevel="DEBUG"/>
            <log message="RECEIVED2, body is 
'${in.body.getClass.getCanonicalName}'" loggingLevel="DEBUG"/>
{code}
and get this output:
{code}
RECEIVED2, body length = '1'
RECEIVED2, body = 'this is the new body'
RECEIVED2, body is 'byte[]'
{code}

Surely this can not be a stream issue? I mean the body is hardcoded here.
I'm using XML instead of java, could that be a problem?

Also, this is using Camel 2.14.0. I'm going to try it with Camel 2.14.2 next.

> byte array length is not correct in simple
> ------------------------------------------
>
>                 Key: CAMEL-8797
>                 URL: https://issues.apache.org/jira/browse/CAMEL-8797
>             Project: Camel
>          Issue Type: Bug
>            Reporter: Calle Kabo
>            Assignee: Claus Ibsen
>
> I have a byte[] containing an XML.
> {code}
> <log message="Body is '${in.body.getClass.getCanonicalName}'" 
> loggingLevel="DEBUG"/>
> <log message="Body = '${in.body}'" loggingLevel="DEBUG"/>
>                             <choice>
>                                 <when>
>                                     <simple>${in.body} is 
> &#39;java.io.File&#39;</simple>
>                                     <setHeader 
> headerName="CamelAwsS3ContentLength">
>                                         <simple>${file:size}</simple>
>                                     </setHeader>
>                                 </when>
>                                 <otherwise>
>                                     <setHeader 
> headerName="CamelAwsS3ContentLength">
>                                         <simple>${in.body.length}</simple>
>                                     </setHeader>
>                                 </otherwise>
>                             </choice>
> <log message="Body length = ${in.header.CamelAwsS3ContentLength}" 
> loggingLevel="DEBUG"/>
> {code}
> The above code outputs the following in the logs:
> {code}
> Body is 'byte[]'
> Body = '<?xml version="1.0" encoding="ISO-8859-1"?><root> /... bla bla bla 
> .../ </root>'
> Body length = 1
> {code}
> Using Camel 2.14.0.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to