You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2013/10/21 06:35:52 UTC
git commit: CAMEL-6873 support the Exchange.CHARSET_NAME header in
camel-gson, with thanks to Fergus
Updated Branches:
refs/heads/master 4559a6a3e -> 325344c68
CAMEL-6873 support the Exchange.CHARSET_NAME header in camel-gson, with thanks to Fergus
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/325344c6
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/325344c6
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/325344c6
Branch: refs/heads/master
Commit: 325344c68c3a7d50689d566c2f51c62ca66a2b35
Parents: 4559a6a
Author: Willem Jiang <ni...@apache.org>
Authored: Mon Oct 21 12:29:49 2013 +0800
Committer: Willem Jiang <ni...@apache.org>
Committed: Mon Oct 21 12:29:49 2013 +0800
----------------------------------------------------------------------
.../java/org/apache/camel/component/gson/GsonDataFormat.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/325344c6/components/camel-gson/src/main/java/org/apache/camel/component/gson/GsonDataFormat.java
----------------------------------------------------------------------
diff --git a/components/camel-gson/src/main/java/org/apache/camel/component/gson/GsonDataFormat.java b/components/camel-gson/src/main/java/org/apache/camel/component/gson/GsonDataFormat.java
index a5537e5..fc1a0d7 100644
--- a/components/camel-gson/src/main/java/org/apache/camel/component/gson/GsonDataFormat.java
+++ b/components/camel-gson/src/main/java/org/apache/camel/component/gson/GsonDataFormat.java
@@ -94,14 +94,14 @@ public class GsonDataFormat extends ServiceSupport implements DataFormat {
@Override
public void marshal(Exchange exchange, Object graph, OutputStream stream) throws Exception {
- BufferedWriter writer = IOHelper.buffered(new OutputStreamWriter(stream));
+ BufferedWriter writer = IOHelper.buffered(new OutputStreamWriter(stream, IOHelper.getCharsetName(exchange)));
gson.toJson(graph, writer);
writer.close();
}
@Override
public Object unmarshal(Exchange exchange, InputStream stream) throws Exception {
- BufferedReader reader = IOHelper.buffered(new InputStreamReader(stream));
+ BufferedReader reader = IOHelper.buffered(new InputStreamReader(stream, IOHelper.getCharsetName(exchange)));
Object result = gson.fromJson(reader, this.unmarshalType);
reader.close();
return result;