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 cef33d579db 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.
cef33d579db is described below
commit cef33d579dbb15401a47e116f7731fa1a8f27165
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.
---
.../apache/camel/component/cxf/converter/CxfConverterLoader.java | 8 ++++++++
.../org/apache/camel/component/cxf/converter/CxfConverter.java | 5 +++++
2 files changed, 13 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 c6bed12eb01..380aa01ec53 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
@@ -69,6 +69,14 @@ public final class CxfConverterLoader implements
TypeConverterLoader, CamelConte
}
return answer;
});
+ addTypeConverter(registry, java.lang.String.class,
org.apache.cxf.message.MessageContentsList.class, false,
+ (type, exchange, value) -> {
+ Object answer =
org.apache.camel.component.cxf.converter.CxfConverter.toString((org.apache.cxf.message.MessageContentsList)
value, exchange);
+ if (false && answer == null) {
+ answer = Void.class;
+ }
+ return answer;
+ });
addTypeConverter(registry, javax.xml.namespace.QName.class,
java.lang.String.class, false,
(type, exchange, value) -> {
Object answer =
org.apache.camel.component.cxf.converter.CxfConverter.toQName((java.lang.String)
value);
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