You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Aki Yoshida (JIRA)" <ji...@apache.org> on 2013/12/09 15:04:08 UTC

[jira] [Commented] (CAMEL-6854) Type conversion between DOMSource and InputStream breaks on Windows

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

Aki Yoshida commented on CAMEL-6854:
------------------------------------

Hi Willem,
I was wondering if the reason for this change not being committed is the test using non-ascii characters that are violating the code check? If that is the case, I am attaching a modified test that does not directly include those non-ascii characters in the code but includes them using their corresponding escaped unicode characters. I even added a few characters to make it more interesting.

regards, aki

> 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
>            Assignee: Willem Jiang
>         Attachments: 0001-CAMEL-6854-Type-conversion-between-DOMSource-and-Inp.patch, 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.4#6159)