This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/master by this push:
     new a88f172  CAMEL-13313: Fixed potential NPE in jaxb fallback type 
converter
a88f172 is described below

commit a88f17287fa4b2241dad0c9e139b8ac71f1dee93
Author: Claus Ibsen <claus.ib...@gmail.com>
AuthorDate: Tue Mar 26 12:14:01 2019 +0100

    CAMEL-13313: Fixed potential NPE in jaxb fallback type converter
---
 .../apache/camel/converter/jaxb/FallbackTypeConverter.java  | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git 
a/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/FallbackTypeConverter.java
 
b/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/FallbackTypeConverter.java
index 8f842f2..08cb0a6 100644
--- 
a/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/FallbackTypeConverter.java
+++ 
b/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/FallbackTypeConverter.java
@@ -121,18 +121,25 @@ public class FallbackTypeConverter {
             }
         }
 
+        TypeConverter converter = null;
+        if (registry instanceof TypeConverter) {
+            converter = (TypeConverter) registry;
+        } else if (exchange != null) {
+            converter = exchange.getContext().getTypeConverter();
+        }
+
         try {
             if (isJaxbType(type, exchange, objectFactory)) {
-                return unmarshall(type, exchange, value, 
exchange.getContext().getTypeConverter());
+                return unmarshall(type, exchange, value, converter);
             }
             if (value != null && isNotStreamCacheType(type)) {
                 if (hasXmlRootElement(value.getClass())) {
-                    return marshall(type, exchange, value, 
exchange.getContext().getTypeConverter(), null, prettyPrint);
+                    return marshall(type, exchange, value, converter, null, 
prettyPrint);
                 }
                 if (objectFactory) {
                     Method objectFactoryMethod = 
JaxbHelper.getJaxbElementFactoryMethod(exchange.getContext(), value.getClass());
                     if (objectFactoryMethod != null) {
-                        return marshall(type, exchange, value, 
exchange.getContext().getTypeConverter(), objectFactoryMethod, prettyPrint);
+                        return marshall(type, exchange, value, converter, 
objectFactoryMethod, prettyPrint);
                     }
                 }
             }

Reply via email to