You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Willem Jiang (JIRA)" <ji...@apache.org> on 2013/10/21 05:53:44 UTC
[jira] [Assigned] (CAMEL-6873) Camel-Gson does not respect
Exchange.CHARSET_NAME
[ https://issues.apache.org/jira/browse/CAMEL-6873?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Willem Jiang reassigned CAMEL-6873:
-----------------------------------
Assignee: Willem Jiang
> Camel-Gson does not respect Exchange.CHARSET_NAME
> -------------------------------------------------
>
> Key: CAMEL-6873
> URL: https://issues.apache.org/jira/browse/CAMEL-6873
> Project: Camel
> Issue Type: Bug
> Components: camel-gson
> Affects Versions: 2.12.0
> Reporter: Fergus Nelson
> Assignee: Willem Jiang
>
> When marshalling and unmarshalling using the gson component it does not respect the Excahnge.CHARSET_NAME property on the exchange. When constructing the Streams the charset should be passed. My changes are highlighted below. Git pull request to follow.
> @Override
> public void marshal(final Exchange exchange, final Object graph, final OutputStream stream) throws Exception {
> BufferedWriter writer = IOHelper.buffered(new OutputStreamWriter(stream{color:red}, IOHelper.getCharsetName(exchange){color}));
> gson.toJson(graph, writer);
> writer.close();
> }
> @Override
> public Object unmarshal(final Exchange exchange, final InputStream stream) throws Exception {
> BufferedReader reader = IOHelper.buffered(new InputStreamReader(stream{color:red}, IOHelper.getCharsetName(exchange){color}));
> Object result = gson.fromJson(reader, this.unmarshalType);
> reader.close();
> return result;
> }
--
This message was sent by Atlassian JIRA
(v6.1#6144)