Aki Yoshida created CAMEL-5877:
----------------------------------

             Summary: Sporadic Source Conversion issues with CxfPayload
                 Key: CAMEL-5877
                 URL: https://issues.apache.org/jira/browse/CAMEL-5877
             Project: Camel
          Issue Type: Bug
          Components: camel-cxf
    Affects Versions: 2.10.3
            Reporter: Aki Yoshida


There is one concrete issue to report and there is an additional point that I 
would like to bring up.

First, the concrete issue is that CxfEndpoints' findName does not currently 
handle SAXSource. Consequently, the it fails to find the element name when the 
payload source is of SAXSource.

This issue can be observed sporadically, as there is a chance the Source could 
be SAXSource. Because of the nature of this problem explained below, this issue 
may be observed non-deterministically and consequently it is not often observed.

What is happening is that, when a conversion to CxfPayload is triggered, 
CxfPayloadConverter's convertTo method arbitrarily picks a converter that can 
convert the input to Source. The code goes into BaseTypeConverterRegistry and 
searches for a matching converter in its type mappings' entry set. As this set 
has no deterministic ordering and there are several matching converters, an 
arbitrary converter is picked up. THe chance of getting the SAXSource converter 
is small but not zero. Therefore, when this happens, CxfEndpoint's findName is 
not finding the element name as there is no handling for SAXSource. 
Interestingly, the DOMSource converter is the most frequently picked converter, 
followed by the StaxSource converter.

So, SAXSource handling needs to be added in CXFEndpoint's findName method.

The second point is about the preferred Source held in CxfPayload. I think for 
jdk 1.6 or above, StAXSource could be the preferred source. In that case, we 
can use the StAXSource converter instead of arbitrarily picking one of the 
Source converters. We can adjust CxfPayloadConverter's convertTo method to look 
up for the StAXSource converter first.

I am attaching a proposed patch (the correction for the first issue and the 
suggestion regarding the second point, assuming StAXSource is preferred.). 
Could you review it and comment on it?

Thanks.

Regards, aki




--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to