camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Claus Ibsen (JIRA)" <j...@apache.org>
Subject [jira] [Assigned] (CAMEL-11723) ManagedCamelContext.dumpRestsAsXml can fail if default charset is not utf-8
Date Thu, 07 Sep 2017 14:41:00 GMT

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

Claus Ibsen reassigned CAMEL-11723:
-----------------------------------

    Assignee: Claus Ibsen

> ManagedCamelContext.dumpRestsAsXml can fail if default charset is not utf-8
> ---------------------------------------------------------------------------
>
>                 Key: CAMEL-11723
>                 URL: https://issues.apache.org/jira/browse/CAMEL-11723
>             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
>            Assignee: Claus Ibsen
>            Priority: Minor
>              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  org.apache.camel.management.mbean.ManagedCamelContext.dumpRestsAsXml
> 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
(v6.4.14#64029)

Mime
View raw message