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

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


The following commit(s) were added to refs/heads/camel-4.10.x by this push:
     new c56dbfc06f7 CAMEL-22103: camel-cxf: CXF RS Rest service with optional 
query parameter fails when the parameter is null.
c56dbfc06f7 is described below

commit c56dbfc06f786396b944e441838dd4ca28c35d36
Author: Claus Ibsen <claus.ib...@gmail.com>
AuthorDate: Thu May 22 18:47:42 2025 +0200

    CAMEL-22103: camel-cxf: CXF RS Rest service with optional query parameter 
fails when the parameter is null.
---
 .../org/apache/camel/component/cxf/converter/CxfConverter.java | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git 
a/components/camel-cxf/camel-cxf-common/src/main/java/org/apache/camel/component/cxf/converter/CxfConverter.java
 
b/components/camel-cxf/camel-cxf-common/src/main/java/org/apache/camel/component/cxf/converter/CxfConverter.java
index 80084df83c4..e837f53d4f9 100644
--- 
a/components/camel-cxf/camel-cxf-common/src/main/java/org/apache/camel/component/cxf/converter/CxfConverter.java
+++ 
b/components/camel-cxf/camel-cxf-common/src/main/java/org/apache/camel/component/cxf/converter/CxfConverter.java
@@ -100,7 +100,15 @@ public final class CxfConverter {
 
     @Converter
     public static String toString(MessageContentsList value, Exchange 
exchange) {
-        return convertTo(String.class, exchange, value, 
exchange.getContext().getTypeConverterRegistry());
+        if (value != null && value.isEmpty()) {
+            return null;
+        }
+
+        Object answer = convertTo(String.class, exchange, value, 
exchange.getContext().getTypeConverterRegistry());
+        if (answer != null && answer != MISS_VALUE) {
+            return answer.toString();
+        }
+        return null;
     }
 
     /**

Reply via email to