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

Willem Jiang resolved CAMEL-6873.
---------------------------------

       Resolution: Fixed
    Fix Version/s: 2.13.0
                   2.12.2
                   2.11.3

Applied the patch into master, camel-2.12.x and camel-2.11.x with thanks to  
Fergus.

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

Reply via email to