You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ff...@apache.org on 2020/07/22 16:37:41 UTC

[camel] branch camel-2.25.x updated: [CAMEL-15328]Honor Optional http headers as method parameters to be null in camel-cxfrs producer

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

ffang pushed a commit to branch camel-2.25.x
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/camel-2.25.x by this push:
     new 525b241  [CAMEL-15328]Honor Optional http headers as method parameters to be null in camel-cxfrs producer
525b241 is described below

commit 525b241eb9105814e87ae80e7aeb7c4cdcd468ec
Author: Freeman Fang <fr...@gmail.com>
AuthorDate: Wed Jul 22 12:32:50 2020 -0400

    [CAMEL-15328]Honor Optional http headers as method parameters to be null in camel-cxfrs producer
    
    (cherry picked from commit b21991b1043d85a1a3a29614fb074f0925fc914a)
    (cherry picked from commit d90328928673c28318caf62b75f37f76e056cdac)
---
 .../java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java  | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java
index 88f8e3a..7df2119 100644
--- a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java
+++ b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java
@@ -508,7 +508,7 @@ public class CxfRsProducer extends DefaultProducer implements AsyncProcessor {
                         continue;
                     }
                     for (int i = 0; i < parameterTypes.length; i++) {
-                        if (!params[i].isAssignableFrom(parameterTypes[i])) {
+                        if (parameterTypes[i] != null && !params[i].isAssignableFrom(parameterTypes[i])) {
                             continue iterate_on_methods;
                         }
                     }
@@ -531,7 +531,11 @@ public class CxfRsProducer extends DefaultProducer implements AsyncProcessor {
         Class<?>[] answer = new Class[objects.length];
         int i = 0;
         for (Object obj : objects) {
-            answer[i] = obj.getClass();
+            if (obj == null) {
+                answer[i] = null;
+            } else {
+                answer[i] = obj.getClass();
+            }
             i++;
         }
         return answer;