This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new 3ef02bf58da CAMEL-22103: camel-cxf: CXF RS Rest service with optional
query parameter fails when the parameter is null.
3ef02bf58da is described below
commit 3ef02bf58da948e157208070e9411a30e0807f48
Author: Claus Ibsen <[email protected]>
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;
}
/**