This is an automated email from the ASF dual-hosted git repository. nfilotto 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 4a2815f4b67 CAMEL-19399: camel-cxf - Don't add entry in Converter cache on error (#10227) 4a2815f4b67 is described below commit 4a2815f4b678d8d999e6a6de239d59bd17468dbc Author: Nicolas Filotto <essob...@users.noreply.github.com> AuthorDate: Tue May 30 14:26:16 2023 +0200 CAMEL-19399: camel-cxf - Don't add entry in Converter cache on error (#10227) ## Motivation If an error occurs while converting a value thanks to the CxfPayloadConverter, the value null is returned to let other fallback converters to try but if there are no such fallback converters, the cache of converters will keep the information that no converter exists which is not incorrect. ## Modifications * Returns `MISS_VALUE` instead of `null` in case of an error to ensure that the result won't be stored in the cache. --- .../org/apache/camel/component/cxf/converter/CxfPayloadConverter.java | 1 + 1 file changed, 1 insertion(+) diff --git a/components/camel-cxf/camel-cxf-common/src/main/java/org/apache/camel/component/cxf/converter/CxfPayloadConverter.java b/components/camel-cxf/camel-cxf-common/src/main/java/org/apache/camel/component/cxf/converter/CxfPayloadConverter.java index e63ac48b80b..c984af7c958 100644 --- a/components/camel-cxf/camel-cxf-common/src/main/java/org/apache/camel/component/cxf/converter/CxfPayloadConverter.java +++ b/components/camel-cxf/camel-cxf-common/src/main/java/org/apache/camel/component/cxf/converter/CxfPayloadConverter.java @@ -179,6 +179,7 @@ public final class CxfPayloadConverter { } catch (RuntimeCamelException e) { // the internal conversion to XML can throw an exception if the content is not XML // ignore this and return MISS_VALUE to indicate that we cannot convert this + return (T) MISS_VALUE; } // Let other fallback converter try return null;