You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Sven Bauhan <sv...@ast.dfs.de> on 2013/06/28 10:54:25 UTC

Bug in org.apache.camel.main.Main#doStop() ?

Hi,

I think I found a bug in org.apache.camel.main.Main#doStop():

When I call a Camel application with parameter -h all parameters are 
printed an the program exits.
But it is no clean exit; it throws an java.lang.IndexOutOfBoundsException.

The reason for this is the expression in doStop():
+
----
getCamelContexts().get(0).stop();
----

I implemented a workaround in my class derived from 
org.apache.camel.main.Main:
+
----
     @Override
     protected void doStop() throws Exception {
         List<?> contexts = getCamelContexts();
         if (contexts != null && ! contexts.isEmpty()) {
             super.doStop();
         } else {
             completed();
         }
     }
----

Is this a real bug, or did I just use org.apache.camel.main.Main the 
wrong way?

Thanks, Sven


Re: Bug in org.apache.camel.main.Main#doStop() ?

Posted by Christian Müller <ch...@gmail.com>.
I cannot look into the code yet, but I think this should be fixed. Feel
free to create a JIRA.

Best,
Christian

Sent from a mobile device
Am 28.06.2013 10:54 schrieb "Sven Bauhan" <sv...@ast.dfs.de>:

> Hi,
>
> I think I found a bug in org.apache.camel.main.Main#**doStop():
>
> When I call a Camel application with parameter -h all parameters are
> printed an the program exits.
> But it is no clean exit; it throws an java.lang.**
> IndexOutOfBoundsException.
>
> The reason for this is the expression in doStop():
> +
> ----
> getCamelContexts().get(0).**stop();
> ----
>
> I implemented a workaround in my class derived from
> org.apache.camel.main.Main:
> +
> ----
>     @Override
>     protected void doStop() throws Exception {
>         List<?> contexts = getCamelContexts();
>         if (contexts != null && ! contexts.isEmpty()) {
>             super.doStop();
>         } else {
>             completed();
>         }
>     }
> ----
>
> Is this a real bug, or did I just use org.apache.camel.main.Main the wrong
> way?
>
> Thanks, Sven
>
>