camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [3/3] camel git commit: CAMEL-9714: camel-boon - Unmarshal to Map does not work
Date Wed, 16 Mar 2016 08:04:21 GMT
CAMEL-9714: camel-boon - Unmarshal to Map does not work


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/14980a0a
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/14980a0a
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/14980a0a

Branch: refs/heads/camel-2.16.x
Commit: 14980a0a876db7f781477367a440309d96c01f01
Parents: 59fc354
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Wed Mar 16 08:53:00 2016 +0100
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Wed Mar 16 09:04:08 2016 +0100

----------------------------------------------------------------------
 .../apache/camel/component/boon/BoonDataFormat.java  | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/14980a0a/components/camel-boon/src/main/java/org/apache/camel/component/boon/BoonDataFormat.java
----------------------------------------------------------------------
diff --git a/components/camel-boon/src/main/java/org/apache/camel/component/boon/BoonDataFormat.java
b/components/camel-boon/src/main/java/org/apache/camel/component/boon/BoonDataFormat.java
index 09a5c10..11ad62a 100644
--- a/components/camel-boon/src/main/java/org/apache/camel/component/boon/BoonDataFormat.java
+++ b/components/camel-boon/src/main/java/org/apache/camel/component/boon/BoonDataFormat.java
@@ -22,7 +22,6 @@ import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.OutputStream;
 import java.io.OutputStreamWriter;
-import java.util.HashMap;
 
 import org.apache.camel.Exchange;
 import org.apache.camel.spi.DataFormat;
@@ -44,7 +43,7 @@ public class BoonDataFormat extends ChildServiceSupport implements DataFormat,
D
     private Class<?> unmarshalType;
 
     public BoonDataFormat() {
-        this(HashMap.class);
+        this(null);
     }
 
     /**
@@ -83,8 +82,16 @@ public class BoonDataFormat extends ChildServiceSupport implements DataFormat,
D
     @Override
     public Object unmarshal(Exchange exchange, InputStream stream) throws Exception {
         BufferedReader reader = IOHelper.buffered(new InputStreamReader(stream, IOHelper.getCharsetName(exchange)));
-        Object result = objectMapper.fromJson(reader, this.unmarshalType);
-        reader.close();
+        Object result;
+        try {
+            if (unmarshalType != null) {
+                result = objectMapper.fromJson(reader, unmarshalType);
+            } else {
+                result = objectMapper.fromJson(reader);
+            }
+        } finally {
+            IOHelper.close(reader);
+        }
         return result;
     }
 


Mime
View raw message