DefaultCamelContext throws NPE in start() for route with no destination
-----------------------------------------------------------------------

                 Key: CAMEL-2486
                 URL: https://issues.apache.org/activemq/browse/CAMEL-2486
             Project: Apache Camel
          Issue Type: Bug
          Components: camel-core
    Affects Versions: 2.2.0
         Environment: Camel 2.2, Linux, Java 6
            Reporter: Michael Mathers
            Priority: Minor


Not easy to track down when you have a lot of routes.  This might be new with 
the introduction of StartupRouteHolder (I think that was introduced in 2.2, 
right?)

{code}
public class TriggerNPETest extends CamelTestSupport {
        @Override
        protected RouteBuilder createRouteBuilder() throws Exception {
        return new RouteBuilder() {
            public void configure() {
                // This will generate an NPE on DefaultCamelContext.start() 
(line 973)
                // If this is an invalid route a proper message should be given 
far before 
                // this and/or NPE should be tested on line 973
                from("direct:psd.nowhere");
            }
        };
        }
        @Test
        public void testme() throws Exception {
                Thread.sleep(10000);
        }
}
{code}

java.lang.NullPointerException
        at 
org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:973)
        at 
org.apache.camel.test.junit4.CamelTestSupport.startCamelContext(CamelTestSupport.java:145)
        at 
org.apache.camel.test.junit4.CamelTestSupport.setUp(CamelTestSupport.java:98)

{code}
            // now start the inputs for all the route services as we have 
prepared Camel
            // yeah open the floods so messages can start flow into Camel
            for (Map.Entry<Integer, StartupRouteHolder> entry : 
inputs.entrySet()) {
                Integer order = entry.getKey();
                Route route = entry.getValue().getRoute();  //  <<<-------  
Right here.
{code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to