You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (Jira)" <ji...@apache.org> on 2021/06/29 10:23:00 UTC
[jira] [Updated] (CAMEL-16767) camel-core - Stoping route failed
when route contains loopDoWhile
[ https://issues.apache.org/jira/browse/CAMEL-16767?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Claus Ibsen updated CAMEL-16767:
--------------------------------
Summary: camel-core - Stoping route failed when route contains loopDoWhile (was: Stoping route failed when route contains loopDoWhile)
> camel-core - Stoping route failed when route contains loopDoWhile
> -----------------------------------------------------------------
>
> Key: CAMEL-16767
> URL: https://issues.apache.org/jira/browse/CAMEL-16767
> Project: Camel
> Issue Type: Bug
> Components: camel-core
> Affects Versions: 3.8.0
> Reporter: Petr Filip
> Priority: Major
> Fix For: 3.11.1, 3.12.0
>
> Original Estimate: 2h
> Remaining Estimate: 2h
>
> Stopping route failed route is not called at least once.
> {code:java}
> @Test
> public void addCamelRouteAndStopAndRemoveFailedTest() throws Exception {
> camelContext.addRoutes(new RouteBuilder() {
> public void configure() {
> from("direct:unitTest").routeId("routeId")
> .loopDoWhile(body().isNotNull())
> .log("im in cycle")
> .end();
> }
> });
> Assert.assertEquals(1, camelContext.getRoutes().size());
> camelContext.getRouteController().suspendRoute("routeId");
> camelContext.removeRoute("routeId");
> Assert.assertEquals(0, camelContext.getRoutes().size());
> }
> {code}
> The problem is in _LoopProcessor.java_ which does not contains default value:
> {code:java}
> @Override
> public int getPendingExchangesSize() {
> return state.getPendingSize(); // here is missing NPE check
> }
> {code}
> Given exception is
> {code:java}
> Caused by: java.lang.NullPointerExceptionCaused by: java.lang.NullPointerException at org.apache.camel.processor.LoopProcessor.getPendingExchangesSize(LoopProcessor.java:94) at org.apache.camel.impl.engine.DefaultShutdownStrategy.getPendingInflightExchanges(DefaultShutdownStrategy.java:776) at org.apache.camel.impl.engine.DefaultShutdownStrategy$ShutdownTask.run(DefaultShutdownStrategy.java:669) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ... 1 more
> {code}
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)