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

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


The following commit(s) were added to refs/heads/camel-3.20.x by this push:
     new 6c4181eade6 CAMEL-19399: camel-cxf - Don't add entry in Converter 
cache on error (#10230)
6c4181eade6 is described below

commit 6c4181eade65233232d5c842c6803b2cad422508
Author: Nicolas Filotto <essob...@users.noreply.github.com>
AuthorDate: Tue May 30 14:25:49 2023 +0200

    CAMEL-19399: camel-cxf - Don't add entry in Converter cache on error 
(#10230)
    
    ## 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;

Reply via email to