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

Stephan Siano updated CAMEL-6854:
---------------------------------

    Attachment: XMLTypeConverterTest.txt

> Type conversion between DOMSource and InputStream breaks on Windows
> -------------------------------------------------------------------
>
>                 Key: CAMEL-6854
>                 URL: https://issues.apache.org/jira/browse/CAMEL-6854
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.10.7, 2.11.2, 2.12.1
>         Environment: Windows
>            Reporter: Stephan Siano
>         Attachments: XMLTypeConverterTest.txt
>
>
> The type conversion between DomSource and InputStream will destroy non-ascii 
> characters if the default charset is not UTF-8.
> Therefore the following test will work on Linux (and in my Eclipse on 
> Windows) where the default charset is UTF-8, but it will not work if invoked 
> from the command line (maven) when the default charset is not UTF-8.
> I will also get similar issues if the type converter are implicitly called by 
> endpoints (the real use case was to read the output of a camel-cxf endpoint 
> as an InputStream).
> import java.io.InputStream;
> import javax.xml.transform.dom.DOMSource;
> import org.apache.camel.builder.RouteBuilder;
> import org.apache.camel.component.mock.MockEndpoint;
> import org.apache.camel.test.junit4.CamelTestSupport;
> import org.junit.Test;
> public class XMLTypeConverterTest extends CamelTestSupport {
>     @Test
>     public void testBase64Marshal() throws InterruptedException {
>         MockEndpoint mock = getMockEndpoint("mock:result");
>         mock.expectedMessageCount(1);
>         template.sendBody("direct:source", 
> "<colors><color>grün</color></colors>");
>         assertMockEndpointsSatisfied();
>         String body = 
> mock.getReceivedExchanges().get(0).getIn().getBody(String.class);
>         assertStringContains(body, "<colors><color>grün</color></colors>");
>     }
>     @Override
>     protected RouteBuilder createRouteBuilder() throws Exception {
>         return new RouteBuilder() {
>             @Override
>             public void configure() throws Exception {
>                 
> from("direct:source").convertBodyTo(DOMSource.class).convertBodyTo(InputStream.class).convertBodyTo(DOMSource.class)
>                         .convertBodyTo(String.class).to("mock:result");
>             }
>         };
>     }
> }



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Reply via email to