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:06:10 UTC
[jira] [Updated] (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:all-tabpanel ]
Aki Yoshida updated CAMEL-6854:
-------------------------------
Attachment: test2.diff
a modified test file with test cases that use escaped unicode characters.
> 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, test2.diff
>
>
> 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)