Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
3.8.0
-
None
-
Novice
Description
Stopping route failed route is not called at least once.
@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()); }
The problem is in LoopProcessor.java which does not contains default value:
@Override public int getPendingExchangesSize() { return state.getPendingSize(); // here is missing NPE check }
Given exception is
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