Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expression extractor fails when there are properties to set #5067

Closed
essobedo opened this issue Jul 6, 2023 · 0 comments · Fixed by #5079
Closed

Expression extractor fails when there are properties to set #5067

essobedo opened this issue Jul 6, 2023 · 0 comments · Fixed by #5079
Assignees
Labels
bug Something isn't working

Comments

@essobedo
Copy link
Contributor

essobedo commented Jul 6, 2023

Bug description

When we have a consumer endpoint with query parameters, the expression extractor fails with an NPE of type:

org.apache.camel.FailedToCreateRouteException: Failed to create route route5: Route(route5)[From[timer:cTimer_1?period=1&repeatCount=1&del... because of Failed to resolve endpoint: timer://cTimer_1?delay=1&period=1&repeatCount=1 due to: Cannot invoke "org.apache.camel.Component.getEndpointPropertyConfigurer()" because the return value of "org.apache.camel.support.DefaultEndpoint.getComponent()" is null
	at org.apache.camel.reifier.RouteReifier.createRoute(RouteReifier.java:82)
	at org.apache.camel.impl.DefaultModelReifierFactory.createRoute(DefaultModelReifierFactory.java:49)
	at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:816)
	at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:685)
	at org.apache.camel.impl.engine.AbstractCamelContext.doInit(AbstractCamelContext.java:2396)
	at org.apache.camel.support.service.BaseService.init(BaseService.java:83)
	at org.apache.camel.impl.engine.AbstractCamelContext.init(AbstractCamelContext.java:2062)
	at org.apache.camel.support.service.BaseService.start(BaseService.java:111)
	at org.apache.camel.impl.engine.AbstractCamelContext.start(AbstractCamelContext.java:2081)
	at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:313)
	at org.apache.camel.quarkus.support.language.deployment.dm.DryModeMain.doStart(DryModeMain.java:81)
	at org.apache.camel.support.service.BaseService.start(BaseService.java:119)
	at org.apache.camel.quarkus.support.language.deployment.LanguageSupportProcessor.extractExpressions(LanguageSupportProcessor.java:62)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:909)
	at io.quarkus.builder.BuildContext.run(BuildContext.java:282)
	at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
	at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2513)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1538)
	at java.base/java.lang.Thread.run(Thread.java:833)
	at org.jboss.threads.JBossThread.run(JBossThread.java:501)
Caused by: org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: timer://cTimer_1?delay=1&period=1&repeatCount=1 due to: Cannot invoke "org.apache.camel.Component.getEndpointPropertyConfigurer()" because the return value of "org.apache.camel.support.DefaultEndpoint.getComponent()" is null
	at org.apache.camel.impl.engine.AbstractCamelContext.doGetEndpoint(AbstractCamelContext.java:856)
	at org.apache.camel.impl.engine.AbstractCamelContext.getEndpoint(AbstractCamelContext.java:758)
	at org.apache.camel.support.CamelContextHelper.getMandatoryEndpoint(CamelContextHelper.java:60)
	at org.apache.camel.reifier.AbstractReifier.resolveEndpoint(AbstractReifier.java:195)
	at org.apache.camel.reifier.RouteReifier.doCreateRoute(RouteReifier.java:96)
	at org.apache.camel.reifier.RouteReifier.createRoute(RouteReifier.java:76)
	... 23 common frames omitted
Caused by: java.lang.NullPointerException: Cannot invoke "org.apache.camel.Component.getEndpointPropertyConfigurer()" because the return value of "org.apache.camel.support.DefaultEndpoint.getComponent()" is null
	at org.apache.camel.support.DefaultEndpoint.setProperties(DefaultEndpoint.java:414)
	at org.apache.camel.support.DefaultEndpoint.configureProperties(DefaultEndpoint.java:394)
	at org.apache.camel.support.DefaultComponent.setProperties(DefaultComponent.java:418)
	at org.apache.camel.support.DefaultComponent.createEndpoint(DefaultComponent.java:186)
	at org.apache.camel.impl.engine.AbstractCamelContext.doGetEndpoint(AbstractCamelContext.java:822)
	... 28 common frames omitted

With a route of type:

from("timer:myTimer?period=1&repeatCount=1&delay=1")
               .log("body value is: ${body}");
@essobedo essobedo added the bug Something isn't working label Jul 6, 2023
@essobedo essobedo self-assigned this Jul 6, 2023
@essobedo essobedo added native and removed native labels Jul 6, 2023
essobedo added a commit that referenced this issue Jul 8, 2023
## Motivation

When we have a consumer endpoint with query parameters, the expression extractor fails with an NPE.

## Modifications:

* Sets the component to the endpoint to avoid NPE
* Makes the endpoint lenient to prevent any failures on properties
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant