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

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


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

commit 9e8fb879e5c5334bae40674c184e5da7c125bf29
Author: Nicolas Filotto <essob...@users.noreply.github.com>
AuthorDate: Tue May 30 14:25:27 2023 +0200

    CAMEL-19399: camel-cxf - Don't add entry in Converter cache on error 
(#10231)
    
    ## 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.
    * Lets other fallback converter try if no converter could be found 
(CAMEL-19160)
---
 .../apache/camel/component/cxf/converter/CxfPayloadConverter.java    | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

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 9b5337d7277..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,9 +179,10 @@ 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;
             }
-            // no we could not do it currently
-            return (T) MISS_VALUE;
+            // Let other fallback converter try
+            return null;
         }
         // Convert a CxfPayload into something else
         if (CxfPayload.class.isAssignableFrom(value.getClass())) {

Reply via email to