You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2019/12/10 04:38:17 UTC
[camel] branch camel-2.24.x updated: [CAMEL-14267] Fix a
nullPointerException in convertIfRequired (#3396)
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch camel-2.24.x
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/camel-2.24.x by this push:
new eb0372d [CAMEL-14267] Fix a nullPointerException in convertIfRequired (#3396)
eb0372d is described below
commit eb0372d415261eb43ecb7c0c3efaab5374003ca9
Author: tfabien <ft...@gmail.com>
AuthorDate: Tue Dec 10 05:11:33 2019 +0100
[CAMEL-14267] Fix a nullPointerException in convertIfRequired (#3396)
Fix a nullPointerException in convertIfRequired when boddy is null
---
.../src/main/java/org/apache/camel/processor/ContractAdvice.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/camel-core/src/main/java/org/apache/camel/processor/ContractAdvice.java b/camel-core/src/main/java/org/apache/camel/processor/ContractAdvice.java
index 521ea12..c2bf4a2 100644
--- a/camel-core/src/main/java/org/apache/camel/processor/ContractAdvice.java
+++ b/camel-core/src/main/java/org/apache/camel/processor/ContractAdvice.java
@@ -143,7 +143,7 @@ public class ContractAdvice implements CamelInternalProcessorAdvice {
private boolean convertIfRequired(Message message, DataType type) throws Exception {
// TODO for better performance it may be better to add TypeConverterTransformer
// into transformer registry automatically to avoid unnecessary scan in transformer registry
- if (type != null && type.isJavaType() && type.getName() != null) {
+ if (type != null && type.isJavaType() && type.getName() != null && message != null && message.getBody() != null) {
CamelContext context = message.getExchange().getContext();
Class<?> typeJava = getClazz(type.getName(), context);
if (!typeJava.isAssignableFrom(message.getBody().getClass())) {
@@ -197,4 +197,4 @@ public class ContractAdvice implements CamelInternalProcessorAdvice {
}
}
-}
\ No newline at end of file
+}