Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
2.24.2
-
None
-
Novice
Description
NullPointerException thrown if the body is null at the end of a route and an outputType is set.
Sample code:
from("timer:foo?repeatCount=1") .setBody().constant("42") .to("direct:sub"); from("direct:sub") .inputType(String.class) .outputType(Integer.class) .setBody().constant(null);
Thrown exception:
java.lang.NullPointerException: nulljava.lang.NullPointerException: null at org.apache.camel.processor.ContractAdvice.convertIfRequired(ContractAdvice.java:149) ~[camel-core-2.24.2.jar:2.24.2] at org.apache.camel.processor.ContractAdvice.doTransform(ContractAdvice.java:124) ~[camel-core-2.24.2.jar:2.24.2] at org.apache.camel.processor.ContractAdvice.after(ContractAdvice.java:103) ~[camel-core-2.24.2.jar:2.24.2] at org.apache.camel.processor.CamelInternalProcessor$InternalCallback.done(CamelInternalProcessor.java:251) ~[camel-core-2.24.2.jar:2.24.2] at org.apache.camel.processor.CamelInternalProcessor$InternalCallback.done(CamelInternalProcessor.java:262) ~[camel-core-2.24.2.jar:2.24.2] at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:579) ~[camel-core-2.24.2.jar:2.24.2] at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201) [camel-core-2.24.2.jar:2.24.2] at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201) [camel-core-2.24.2.jar:2.24.2] at org.apache.camel.component.direct.DirectProducer.process(DirectProducer.java:76) ~[camel-core-2.24.2.jar:2.24.2] at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:148) ~[camel-core-2.24.2.jar:2.24.2] at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:548) ~[camel-core-2.24.2.jar:2.24.2] at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201) [camel-core-2.24.2.jar:2.24.2] at org.apache.camel.processor.Pipeline.process(Pipeline.java:138) ~[camel-core-2.24.2.jar:2.24.2] at org.apache.camel.processor.Pipeline.process(Pipeline.java:101) ~[camel-core-2.24.2.jar:2.24.2] at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201) [camel-core-2.24.2.jar:2.24.2] at org.apache.camel.component.timer.TimerConsumer.sendTimerExchange(TimerConsumer.java:197) [camel-core-2.24.2.jar:2.24.2] at org.apache.camel.component.timer.TimerConsumer$1.run(TimerConsumer.java:79) [camel-core-2.24.2.jar:2.24.2] at java.util.TimerThread.mainLoop(Timer.java:555) [na:1.8.0_66] at java.util.TimerThread.run(Timer.java:505) [na:1.8.0_66]