Author: ningjiang Date: Tue Dec 18 08:47:39 2012 New Revision: 1423340 URL: http://svn.apache.org/viewvc?rev=1423340&view=rev Log: CAMEL-5890 fixed the NPE when jaxb fallbackConverter is used with RequestEntityConverter Merged revisions 1423309 via svnmerge from https://svn.apache.org/repos/asf/camel/branches/camel-2.10.x
................ r1423309 | ningjiang | 2012-12-18 16:04:30 +0800 (Tue, 18 Dec 2012) | 14 lines Merged revisions 1423299,1423304 via svnmerge from https://svn.apache.org/repos/asf/camel/trunk ........ r1423299 | ningjiang | 2012-12-18 15:06:50 +0800 (Tue, 18 Dec 2012) | 1 line CAMEL-5890 fixed the NPE when jaxb fallbackConverter is used with RequestEntityConverter ........ r1423304 | ningjiang | 2012-12-18 15:41:58 +0800 (Tue, 18 Dec 2012) | 1 line CAMEL-5890 Fixed the CS error of JaxbFallbackTypeConverterTest ........ ................ Added: camel/branches/camel-2.9.x/tests/camel-itest/src/test/java/org/apache/camel/itest/jaxb/JaxbFallbackTypeConverterTest.java - copied unchanged from r1423309, camel/branches/camel-2.10.x/tests/camel-itest/src/test/java/org/apache/camel/itest/jaxb/JaxbFallbackTypeConverterTest.java camel/branches/camel-2.9.x/tests/camel-itest/src/test/java/org/apache/camel/itest/jaxb/example/ - copied from r1423309, camel/branches/camel-2.10.x/tests/camel-itest/src/test/java/org/apache/camel/itest/jaxb/example/ camel/branches/camel-2.9.x/tests/camel-itest/src/test/java/org/apache/camel/itest/jaxb/example/Bar.java - copied unchanged from r1423309, camel/branches/camel-2.10.x/tests/camel-itest/src/test/java/org/apache/camel/itest/jaxb/example/Bar.java Modified: camel/branches/camel-2.9.x/ (props changed) camel/branches/camel-2.9.x/components/camel-http/src/main/java/org/apache/camel/component/http/RequestEntityConverter.java camel/branches/camel-2.9.x/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/FallbackTypeConverter.java Propchange: camel/branches/camel-2.9.x/ ------------------------------------------------------------------------------ Merged /camel/trunk:r1423299,1423304 Merged /camel/branches/camel-2.10.x:r1423309 Propchange: camel/branches/camel-2.9.x/ ------------------------------------------------------------------------------ Binary property 'svnmerge-integrated' - no diff available. Modified: camel/branches/camel-2.9.x/components/camel-http/src/main/java/org/apache/camel/component/http/RequestEntityConverter.java URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/components/camel-http/src/main/java/org/apache/camel/component/http/RequestEntityConverter.java?rev=1423340&r1=1423339&r2=1423340&view=diff ============================================================================== --- camel/branches/camel-2.9.x/components/camel-http/src/main/java/org/apache/camel/component/http/RequestEntityConverter.java (original) +++ camel/branches/camel-2.9.x/components/camel-http/src/main/java/org/apache/camel/component/http/RequestEntityConverter.java Tue Dec 18 08:47:39 2012 @@ -48,7 +48,7 @@ public final class RequestEntityConverte @Converter public static RequestEntity toRequestEntity(String str, Exchange exchange) throws Exception { - if (GZIPHelper.isGzip(exchange.getIn())) { + if (exchange != null && GZIPHelper.isGzip(exchange.getIn())) { byte[] data = exchange.getContext().getTypeConverter().convertTo(byte[].class, str); return asRequestEntity(data, exchange); } else { Modified: camel/branches/camel-2.9.x/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/FallbackTypeConverter.java URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/FallbackTypeConverter.java?rev=1423340&r1=1423339&r2=1423340&view=diff ============================================================================== --- camel/branches/camel-2.9.x/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/FallbackTypeConverter.java (original) +++ camel/branches/camel-2.9.x/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/FallbackTypeConverter.java Tue Dec 18 08:47:39 2012 @@ -219,7 +219,8 @@ public class FallbackTypeConverter exten } else { marshaller.marshal(value, buffer); } - answer = parentTypeConverter.convertTo(type, buffer.toString()); + // we need to pass the exchange + answer = parentTypeConverter.convertTo(type, exchange, buffer.toString()); } return answer;
