Hi

Looking into MessageSupport getBody(type) I was a bit puzzled with the
code vs. the comment

The code below is from a old version, eg 1 year old. This is highly
what James have coded.
However as I see it we do the opposite, we covert the body = payload
first. And if its null then we do on the message itself.

James, anyone?

PS: The code in trunk is basically the same, except it catches the
NoTypeConverterException as we do not return null for non converters.


  protected <T> T getBody(Class<T> type, Object body) {
        Exchange e = getExchange();
        if (e != null) {
            TypeConverter converter = e.getContext().getTypeConverter();
            T answer = converter.convertTo(type, body);
            if (answer == null) {
                // lets first try converting the message itself first
                // as for some types like InputStream v Reader its
more efficient to do the transformation
                // from the Message itself as its got efficient
implementations of them, before trying the
                // payload
                answer = converter.convertTo(type, this);
            }
            return answer;
        }
        return (T)getBody();
    }

-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/

Reply via email to