Red Hat Bugzilla – Bug 984822
SY ignores toString method when converting objects to string
Last modified: 2015-08-02 19:44:10 EDT
Since the tight integration between Camel and SwitchYard was introduced the POJO messages are automatically converted to XML whenever String representation is required, including message trace.
In the past when toString method was present, it was used to conversion to String. I recommend to return back to this practice - when toString() is declared it should be used, otherwise the conversion could be delegated to Camel internals
I'm going to need an example here as I have not seen this behavior.
ok, so upon further investigation - I did not notice previously that the POJO in question is JAXB-annotated. So whenever there is an internal conversion to string (like for MessageTrace) and the JAXB annotations are present then Camel converter will convert the pojo to XML string.
There's not a whole lot we can about this. Users are free to register an ExchangeInterceptor and call toString() on the payload directly if they want to dump the content.