Camel ActiveMQComponent - Please add validation of unknown or invalid URI 
parameters
------------------------------------------------------------------------------------

                 Key: AMQ-2240
                 URL: https://issues.apache.org/activemq/browse/AMQ-2240
             Project: ActiveMQ
          Issue Type: Bug
          Components: Broker
    Affects Versions: 5.2.0
            Reporter: Claus Ibsen


AMQ is used a lot with Camel and vice-versa. In AMQ there is a 
activemq-camel.jar for easy AMQ-Camel integration.

As Camel often uses URI for configuration we in Camel have validation for all 
parameters provided in the URI.
But this is lacked in the activemq-camel.jar so you can provide bogus or 
misspelled options and AMQ just keeps on running.
This is serious as it can be hard to overlook a tiny misspelled option and you 
think that it runs with this parameter, but it does not!

This seems to only apply for "nested" URI options, eg the options prefixed with
- jms
- broker


For instance using this factory method:
{code}
org.apache.activemq.camel.component.ActiveMQComponent.activeMQComponent(String 
uri);
{code}

In the sample code below, for a unit test, where I have mistyped some URI 
options by inserting XXX or the likes:
{code}
        ActiveMQComponent activemq = 
activeMQComponent("vm://localhost?broker.XXX=foo&broker.persistent=XXX&broker.useJmx=false&jms.redeliveryPolicy.maximumRedeliveries=0&jms.redeliveryPolicy.initialRedeliveryDelay=500&jms.useAsyncSend=false&jms.sendTimeout=ABC&jms.maxXXXXReconnectAttempts=1&jms.timeout=3000");
{code}

But AMQ 5.2 is just started without any error indications
{code}
2009-05-01 09:16:53,247 [main           ] INFO  BrokerService                  
- ActiveMQ 5.2.0 JMS Message Broker (localhost) is starting
2009-05-01 09:16:53,248 [main           ] INFO  BrokerService                  
- For help or more information please see: http://activemq.apache.org/
2009-05-01 09:16:53,392 [main           ] INFO  KahaStore                      
- Kaha Store using data directory activemq-data/localhost/kr-store/data
2009-05-01 09:16:53,513 [main           ] INFO  BrokerService                  
- ActiveMQ JMS Message Broker (localhost, 
ID:davsclaus.local-50096-1241162213265-0:0) started
2009-05-01 09:16:53,520 [main           ] INFO  TransportConnector             
- Connector vm://localhost Started
{code}

But if I enter an invalid URI without the prefix such as: bla=foo
{code}
        ActiveMQComponent activemq = 
activeMQComponent("vm://localhost?bla=foo");
{code}

I get a nice error report
{code}
org.apache.camel.RuntimeCamelException: 
org.springframework.jms.UncategorizedJmsException: Uncategorized exception 
occured during JMS processing; nested exception is javax.jms.JMSException: 
Could not create Transport. Reason: java.lang.IllegalArgumentException: Invalid 
connect parameters: {bla=foo}
{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