You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by "Hadrian Zbarcea (JIRA)" <ji...@apache.org> on 2008/10/23 21:52:52 UTC

[jira] Updated: (CAMEL-744) xstream produces empty body

     [ https://issues.apache.org/activemq/browse/CAMEL-744?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Hadrian Zbarcea updated CAMEL-744:
----------------------------------

    Fix Version/s: 1.5.0

> xstream produces empty body
> ---------------------------
>
>                 Key: CAMEL-744
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-744
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-stream
>    Affects Versions: 1.4.0
>         Environment: Windows Server 2003; jdk1.6.0_06 
>            Reporter: Vadim Chekan
>            Priority: Critical
>             Fix For: 1.5.0
>
>
> 1. Set -Dfile.encoding=Cp1252
> 2. Set tracing ON.
> 3. Run the code:
> ====================================================
> from("timer://kickoff?period=10000").
> 		process(new Processor() {
> 			public void process(Exchange exchange) throws Exception {
> 				ArrayList<HashMap<String, Object>> rows = new ArrayList<HashMap<String, Object>>();
> 				HashMap<String, Object> row = new HashMap<String, Object>();
> 				row.put("column1", "Value 1");
> 				rows.add(row);
> 				exchange.getOut().setBody(rows);
> 			}
> 		}).
> 		marshal().xstream().
> 		to("mock:result");
> ====================================================
> 3. Observe output:
> ====================================================
> Jul 22, 2008 11:35:28 AM org.apache.camel.processor.Logger process
> INFO: ID-vchekan/4855-1216751728436/1-0 -> interceptor1 Interceptor[Delegate(Pipeline[DeadLetterChannel[Delegate(TraceInterceptor[Processor[enviance.org.test.MessageBrokerPackage$1@13e0aba]]), RecipientList[log:org.apache.camel.DeadLetterChannel?level=error], RedeliveryPolicy[maximumRedeliveries=6]], DeadLetterChannel[Delegate(TraceInterceptor[Marshal[org.apache.camel.model.dataformat.XStreamDataFormat@3257b8]]), RecipientList[log:org.apache.camel.DeadLetterChannel?level=error], RedeliveryPolicy[maximumRedeliveries=6]], DeadLetterChannel[Delegate(TraceInterceptor[To[mock:result]]), RecipientList[log:org.apache.camel.DeadLetterChannel?level=error], RedeliveryPolicy[maximumRedeliveries=6]]])] InOnly Properties:{org.apache.camel.timer.time=null, org.apache.camel.timer.period=10000, org.apache.camel.timer.name=kickoff} Headers:{} BodyType:null Body:Message: null
> Jul 22, 2008 11:35:28 AM org.apache.camel.processor.Logger process
> INFO: ID-vchekan/4855-1216751728436/1-0 -> processor1 Processor[enviance.org.test.MessageBrokerPackage$1@13e0aba] InOnly Properties:{org.apache.camel.timer.time=null, org.apache.camel.timer.period=10000, CamelCauseException=null, org.apache.camel.timer.name=kickoff} Headers:{} BodyType:null Body:Message: null
> Jul 22, 2008 11:35:28 AM org.apache.camel.processor.Logger process
> INFO: ID-vchekan/4855-1216751728436/1-0 -> marshal1 Marshal[org.apache.camel.model.dataformat.XStreamDataFormat@3257b8] InOnly Properties:{org.apache.camel.timer.time=null, org.apache.camel.timer.period=10000, CamelCauseException=null, org.apache.camel.timer.name=kickoff} Headers:{} BodyType:java.util.ArrayList Body:[{column1=Value 1}]
> Jul 22, 2008 11:35:29 AM org.apache.camel.processor.Logger process
> INFO: ID-vchekan/4855-1216751728436/1-0 -> to1 To[mock:result] InOnly Properties:{org.apache.camel.timer.time=null, org.apache.camel.timer.period=10000, CamelCauseException=null, org.apache.camel.timer.name=kickoff} Headers:{} BodyType:[B Body:
> ====================================================
> As you see xstream returms an empty array (the end of the last line).
> 4. Change encoding in step 1 to -Dfile.encoding=UTF-8 and re-run the application.
> ====================================================
> Jul 22, 2008 11:40:18 AM org.apache.camel.processor.Logger process
> INFO: ID-vchekan/4875-1216752017927/1-0 -> interceptor1 Interceptor[Delegate(Pipeline[DeadLetterChannel[Delegate(TraceInterceptor[Processor[enviance.org.test.MessageBrokerPackage$1@13e0aba]]), RecipientList[log:org.apache.camel.DeadLetterChannel?level=error], RedeliveryPolicy[maximumRedeliveries=6]], DeadLetterChannel[Delegate(TraceInterceptor[Marshal[org.apache.camel.model.dataformat.XStreamDataFormat@3257b8]]), RecipientList[log:org.apache.camel.DeadLetterChannel?level=error], RedeliveryPolicy[maximumRedeliveries=6]], DeadLetterChannel[Delegate(TraceInterceptor[To[mock:result]]), RecipientList[log:org.apache.camel.DeadLetterChannel?level=error], RedeliveryPolicy[maximumRedeliveries=6]]])] InOnly Properties:{org.apache.camel.timer.time=null, org.apache.camel.timer.period=10000, org.apache.camel.timer.name=kickoff} Headers:{} BodyType:null Body:Message: null
> Jul 22, 2008 11:40:18 AM org.apache.camel.processor.Logger process
> INFO: ID-vchekan/4875-1216752017927/1-0 -> processor1 Processor[enviance.org.test.MessageBrokerPackage$1@13e0aba] InOnly Properties:{org.apache.camel.timer.time=null, org.apache.camel.timer.period=10000, CamelCauseException=null, org.apache.camel.timer.name=kickoff} Headers:{} BodyType:null Body:Message: null
> Jul 22, 2008 11:40:18 AM org.apache.camel.processor.Logger process
> INFO: ID-vchekan/4875-1216752017927/1-0 -> marshal1 Marshal[org.apache.camel.model.dataformat.XStreamDataFormat@3257b8] InOnly Properties:{org.apache.camel.timer.time=null, org.apache.camel.timer.period=10000, CamelCauseException=null, org.apache.camel.timer.name=kickoff} Headers:{} BodyType:java.util.ArrayList Body:[{column1=Value 1}]
> Jul 22, 2008 11:40:18 AM org.apache.camel.processor.Logger process
> INFO: ID-vchekan/4875-1216752017927/1-0 -> to1 To[mock:result] InOnly Properties:{org.apache.camel.timer.time=null, org.apache.camel.timer.period=10000, CamelCauseException=null, org.apache.camel.timer.name=kickoff} Headers:{} BodyType:[B Body:<?xml version="1.0" ?><list><map><entry><string>column1</string><string>Value 1</string></entry></map></list>
> ====================================================
> You see xml now.
> I think it is a bug when xstream component silently refuses to work by producing empty output. It should either take into account configured encoding when producing output or explicitly refuse to work if encoding is "wrong" (throw an exception explaining the reasons of error).
> Fixing this error is important because it affects at least 2 windows environments: Eclipse and ActiveMQ.
> By default Eclipse on Windows has Cp1252 encoding set.
> I do not know what encoding is set in ActiveMQ for Windows but it does not work unless activemq.bat is edited and encoding is explicitly set there.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.