camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Willem Jiang (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (CAMEL-6854) Type conversion between DOMSource and InputStream breaks on Windows
Date Tue, 10 Dec 2013 07:56:09 GMT

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

Willem Jiang resolved CAMEL-6854.
---------------------------------

       Resolution: Fixed
    Fix Version/s: 2.13.0
                   2.12.3
                   2.11.3

Applied the patch into master, camel-2.12.x and camel-2.11.x branches.

> 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
>             Fix For: 2.11.3, 2.12.3, 2.13.0
>
>         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)

Mime
View raw message