[ https://issues.apache.org/jira/browse/CAMEL-21129?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Thomas Jodes updated CAMEL-21129: --------------------------------- Description: {{Rest Route creation fails with a NPE, setup using restConfiguration().{color:#d8d8d8}clientRequestValidation{color}(true) with a JSON-binding to a Java type like rest("/foo").get("/bar").outType(MyType.class).to("bean:one?method=baz").}} Root Cause: Changes from 4.6 to 4.7 in RestBindingAdvisorFactory#build(...) local variable "outJson" is always null, leading to the NPE for sure at the line seen in the exception trace below. In 4.6, "outJson" [is created for sure here|#L76]] In 4.7, "outJson" [remains null here|https://github.com/apache/camel/blob/a2212f39466d7ef9185b6557f872ca9a8a7da3b8/core/camel-support/src/main/java/org/apache/camel/support/processor/RestBindingAdviceFactory.java#L70] and will [lead to the NPE here|#L174]].] {{Caused by: java.lang.NullPointerException: Cannot invoke "Object.getClass()" because "target" is null}} {{ at org.apache.camel.impl.engine.IntrospectionSupport.setProperty(IntrospectionSupport.java:551)}} {{ at org.apache.camel.impl.engine.IntrospectionSupport.setProperty(IntrospectionSupport.java:691)}} {{ at org.apache.camel.impl.engine.DefaultBeanIntrospection.setProperty(DefaultBeanIntrospection.java:220)}} {{ at org.apache.camel.support.processor.RestBindingAdviceFactory.setupJson(RestBindingAdviceFactory.java:174)}} {{ at org.apache.camel.support.processor.RestBindingAdviceFactory.build(RestBindingAdviceFactory.java:80)}} {{{{{}Setting restConfiguration().{}}}clientRequestValidation{{{}(false){}}} will overgo the critical unit of code.}} was: {{Rest Route creation fails with a NPE, setup using restConfiguration().{color:#d8d8d8}clientRequestValidation{color}(true) with a JSON-binding to a Java type like rest("/foo").get("/bar").outType(MyType.class).to("bean:one?method=baz").}} Root Cause: Changes from 4.6 to 4.7 in RestBindingAdvisorFactory#build(...) local variable "outJson" is always null, leading to the NPE for sure at the line seen in the exception trace below. In 4.6, "outJson" [is created for sure here|#L76]] In 4.7, "outJson" [remains null here|https://github.com/apache/camel/blob/a2212f39466d7ef9185b6557f872ca9a8a7da3b8/core/camel-support/src/main/java/org/apache/camel/support/processor/RestBindingAdviceFactory.java#L70] and will [lead to the NPE here|#L174]].] {{Caused by: java.lang.NullPointerException: Cannot invoke "Object.getClass()" because "target" is null}} {{ at org.apache.camel.impl.engine.IntrospectionSupport.setProperty(IntrospectionSupport.java:551)}} {{ at org.apache.camel.impl.engine.IntrospectionSupport.setProperty(IntrospectionSupport.java:691)}} {{ at org.apache.camel.impl.engine.DefaultBeanIntrospection.setProperty(DefaultBeanIntrospection.java:220)}} {{ at org.apache.camel.support.processor.RestBindingAdviceFactory.setupJson(RestBindingAdviceFactory.java:174)}} {{ at org.apache.camel.support.processor.RestBindingAdviceFactory.build(RestBindingAdviceFactory.java:80)}} {{{}Setting {{restConfiguration().{}}}clientRequestValidation{{{}(false)}} will overgo the critical unit of code.{}}} > NPE rooted in RestBindingAdviceFactory in camel-support after upgrade 4.6->4.7 > ------------------------------------------------------------------------------ > > Key: CAMEL-21129 > URL: https://issues.apache.org/jira/browse/CAMEL-21129 > Project: Camel > Issue Type: Bug > Components: camel-core > Affects Versions: 4.7.0 > Reporter: Thomas Jodes > Priority: Major > > {{Rest Route creation fails with a NPE, setup using > restConfiguration().{color:#d8d8d8}clientRequestValidation{color}(true) with > a JSON-binding to a Java type like > rest("/foo").get("/bar").outType(MyType.class).to("bean:one?method=baz").}} > > Root Cause: Changes from 4.6 to 4.7 in RestBindingAdvisorFactory#build(...) > local variable "outJson" is always null, leading to the NPE for sure at the > line seen in the exception trace below. > In 4.6, "outJson" [is created for sure here|#L76]] > In 4.7, "outJson" [remains null > here|https://github.com/apache/camel/blob/a2212f39466d7ef9185b6557f872ca9a8a7da3b8/core/camel-support/src/main/java/org/apache/camel/support/processor/RestBindingAdviceFactory.java#L70] > and will [lead to the NPE here|#L174]].] > {{Caused by: java.lang.NullPointerException: Cannot invoke > "Object.getClass()" because "target" is null}} > {{ at > org.apache.camel.impl.engine.IntrospectionSupport.setProperty(IntrospectionSupport.java:551)}} > {{ at > org.apache.camel.impl.engine.IntrospectionSupport.setProperty(IntrospectionSupport.java:691)}} > {{ at > org.apache.camel.impl.engine.DefaultBeanIntrospection.setProperty(DefaultBeanIntrospection.java:220)}} > {{ at > org.apache.camel.support.processor.RestBindingAdviceFactory.setupJson(RestBindingAdviceFactory.java:174)}} > {{ at > org.apache.camel.support.processor.RestBindingAdviceFactory.build(RestBindingAdviceFactory.java:80)}} > > {{{{{}Setting restConfiguration().{}}}clientRequestValidation{{{}(false){}}} > will overgo the critical unit of code.}} > > -- This message was sent by Atlassian Jira (v8.20.10#820010)