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 2015/03/28 04:13:57 UTC
camel git commit: CAMEL-8554 Just catch the exception when the
ObjectMapper cannot convert the message
Repository: camel
Updated Branches:
refs/heads/master 93a7beba0 -> 21f48497c
CAMEL-8554 Just catch the exception when the ObjectMapper cannot convert the message
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/21f48497
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/21f48497
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/21f48497
Branch: refs/heads/master
Commit: 21f48497c31aa57009ba1e2c4b5b5b81f1be3b5d
Parents: 93a7beb
Author: Willem Jiang <wi...@gmail.com>
Authored: Sat Mar 28 11:05:57 2015 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Sat Mar 28 11:12:09 2015 +0800
----------------------------------------------------------------------
.../component/jackson/converter/JacksonTypeConverters.java | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/21f48497/components/camel-jackson/src/main/java/org/apache/camel/component/jackson/converter/JacksonTypeConverters.java
----------------------------------------------------------------------
diff --git a/components/camel-jackson/src/main/java/org/apache/camel/component/jackson/converter/JacksonTypeConverters.java b/components/camel-jackson/src/main/java/org/apache/camel/component/jackson/converter/JacksonTypeConverters.java
index edaffb2..4aa1150 100644
--- a/components/camel-jackson/src/main/java/org/apache/camel/component/jackson/converter/JacksonTypeConverters.java
+++ b/components/camel-jackson/src/main/java/org/apache/camel/component/jackson/converter/JacksonTypeConverters.java
@@ -31,7 +31,12 @@ public final class JacksonTypeConverters {
@FallbackConverter
public static <T> T convertTo(Class<T> type, Exchange exchange, Object value, TypeConverterRegistry registry) {
if (value instanceof Map) {
- return new ObjectMapper().convertValue(value, type);
+ try {
+ return new ObjectMapper().convertValue(value, type);
+ } catch (Exception ex) {
+ // Just catch the exception and return null when the ObjectMapper cannot convert the value
+ return null;
+ }
}
return null;
}