This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch camel-4.8.x
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/camel-4.8.x by this push:
new a28910b83f5 CAMEL-21912: camel-cxf - Fix convert MessageContentList to
String should use special converter and not generic toString converter that
does not handle the special Apache CXF MessageContentList class that is
extending ArrayList. Thanks to Dave Riseley for reporting and reproducer.
a28910b83f5 is described below
commit a28910b83f54ac130ceb7d5c580edb6090d9b3db
Author: Claus Ibsen <[email protected]>
AuthorDate: Sun Apr 20 10:49:15 2025 +0200
CAMEL-21912: camel-cxf - Fix convert MessageContentList to String should
use special converter and not generic toString converter that does not handle
the special Apache CXF MessageContentList class that is extending ArrayList.
Thanks to Dave Riseley for reporting and reproducer.
---
.../org/apache/camel/component/cxf/converter/CxfConverterLoader.java | 2 ++
.../java/org/apache/camel/component/cxf/converter/CxfConverter.java | 5 +++++
2 files changed, 7 insertions(+)
diff --git
a/components/camel-cxf/camel-cxf-common/src/generated/java/org/apache/camel/component/cxf/converter/CxfConverterLoader.java
b/components/camel-cxf/camel-cxf-common/src/generated/java/org/apache/camel/component/cxf/converter/CxfConverterLoader.java
index 3a1356e3a66..57b8d19752f 100644
---
a/components/camel-cxf/camel-cxf-common/src/generated/java/org/apache/camel/component/cxf/converter/CxfConverterLoader.java
+++
b/components/camel-cxf/camel-cxf-common/src/generated/java/org/apache/camel/component/cxf/converter/CxfConverterLoader.java
@@ -51,6 +51,8 @@ public final class CxfConverterLoader implements
TypeConverterLoader, CamelConte
(type, exchange, value) ->
org.apache.camel.component.cxf.converter.CxfConverter.toArray(value));
addTypeConverter(registry, java.lang.String.class,
jakarta.xml.soap.SOAPMessage.class, false,
(type, exchange, value) ->
org.apache.camel.component.cxf.converter.CxfConverter.soapMessageToString((jakarta.xml.soap.SOAPMessage)
value, exchange));
+ addTypeConverter(registry, java.lang.String.class,
org.apache.cxf.message.MessageContentsList.class, false,
+ (type, exchange, value) ->
org.apache.camel.component.cxf.converter.CxfConverter.toString((org.apache.cxf.message.MessageContentsList)
value, exchange));
addTypeConverter(registry, javax.xml.namespace.QName.class,
java.lang.String.class, false,
(type, exchange, value) ->
org.apache.camel.component.cxf.converter.CxfConverter.toQName((java.lang.String)
value));
addTypeConverter(registry,
org.apache.camel.component.cxf.common.DataFormat.class, java.lang.String.class,
false,
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 8ed02c22bd0..80084df83c4 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
@@ -98,6 +98,11 @@ public final class CxfConverter {
return DataFormat.valueOf(name.toUpperCase());
}
+ @Converter
+ public static String toString(MessageContentsList value, Exchange
exchange) {
+ return convertTo(String.class, exchange, value,
exchange.getContext().getTypeConverterRegistry());
+ }
+
/**
* Use a fallback type converter so we can convert the embedded list
element if the value is MessageContentsList.
* The algorithm of this converter finds the first non-null list element
from the list and applies conversion to the