camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <>
Subject [jira] [Commented] (CAMEL-11723) ManagedCamelContext.dumpRestsAsXml can fail if default charset is not utf-8
Date Wed, 30 Aug 2017 10:24:00 GMT


ASF GitHub Bot commented on CAMEL-11723:

GitHub user pchhabra11 opened a pull request:

    Fix for CAMEL-11723


You can merge this pull request into a Git repository by running:

    $ git pull CAMEL-11723

Alternatively you can review and apply these changes as the patch at:

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #1906
commit 21e2821f46d610be27d26c198a9bda45e75c3e5a
Author: Pulkit <>
Date:   2017-08-30T10:10:41Z

    Fix for CAMEL-11723


> ManagedCamelContext.dumpRestsAsXml can fail if default charset is not utf-8
> ---------------------------------------------------------------------------
>                 Key: CAMEL-11723
>                 URL:
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core, jmx
>    Affects Versions: 2.18.4
>         Environment: Windows, default charset is not UTF-8
>            Reporter: Niels Ull Harremoes
>              Labels: easyfix, windows
>   Original Estimate: 2h
>  Remaining Estimate: 2h
> I am trying to access the rest definitions using the swagger servlet. 
> My operation description is in Danish and includes the character "æ".
> Thus, the xml string generated in line 371 of
> contains the character "æ".
> In line 376-377, wh have
> {code}
>        InputStream is = new ByteArrayInputStream(xml.getBytes());
>         Document dom = XmlLineNumberParser.parseXml(is, new ...)
> {code}
> The call to xml.getBytes() uses the default encoding (CP-1252 in my case), which will
encode æ as a single byte. The xml parser expects UTF-8 (since the xml starts with an xml
declaration specifying encoding="UTF-8"). 
> Therefore, it fails with "Invalid byte 2 of 3-byte UTF-8 sequence".
> The fix is simple - change xml.getBytes() to xml.getBytes("UTF-8");

This message was sent by Atlassian JIRA

View raw message