This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch camel-2.x
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/camel-2.x by this push:
new a3cc992 [CAMEL-14267] Fix a nullPointerException in convertIfRequired
(#3396)
a3cc992 is described below
commit a3cc992f374c74c4675b3ea70a23e2edd4fd6bec
Author: tfabien <[email protected]>
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
+}