Return-Path: Delivered-To: apmail-activemq-dev-archive@www.apache.org Received: (qmail 36736 invoked from network); 12 Jul 2010 16:58:48 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 12 Jul 2010 16:58:48 -0000 Received: (qmail 88902 invoked by uid 500); 12 Jul 2010 16:58:48 -0000 Delivered-To: apmail-activemq-dev-archive@activemq.apache.org Received: (qmail 88837 invoked by uid 500); 12 Jul 2010 16:58:47 -0000 Mailing-List: contact dev-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list dev@activemq.apache.org Received: (qmail 88829 invoked by uid 99); 12 Jul 2010 16:58:47 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 12 Jul 2010 16:58:47 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.22] (HELO thor.apache.org) (140.211.11.22) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 12 Jul 2010 16:58:44 +0000 Received: from thor (localhost [127.0.0.1]) by thor.apache.org (8.13.8+Sun/8.13.8) with ESMTP id o6CGor5s008251 for ; Mon, 12 Jul 2010 16:50:53 GMT Message-ID: <33174410.39971278953453140.JavaMail.jira@thor> Date: Mon, 12 Jul 2010 12:50:53 -0400 (EDT) From: "Gary Tully (JIRA)" To: dev@activemq.apache.org Subject: [jira] Commented: (AMQ-2823) ActiveMQ URI: parsing errors for failover URI (composite URI) In-Reply-To: <298288.39951278951951781.JavaMail.jira@thor> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: ae95407df07c98740808b2ef9da0087c X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/activemq/browse/AMQ-2823?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=60611#action_60611 ] Gary Tully commented on AMQ-2823: --------------------------------- could you validate against trunk or add your variants to http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/failover/FailoverUriTest.java?view=markup there have been some improvements in this area for 5.4 > ActiveMQ URI: parsing errors for failover URI (composite URI) > ------------------------------------------------------------- > > Key: AMQ-2823 > URL: https://issues.apache.org/activemq/browse/AMQ-2823 > Project: ActiveMQ > Issue Type: Bug > Components: Broker > Affects Versions: 5.2.0 > Reporter: Javier Michelson > > Symptoms > the following URI "patterns" cause unexpected behaviour: > 1) failover://(tcp://host:port)?connectionParameter=value > 2) failover://(tcp://host:port?tcpParameter=value1)?failoverParameter=value3 > 3) failover://(tcp://host:port?tcpParameter=value1)?connectionParamater=value2&failoverParameter=value3 > 1) A failover URL is not parsed correctly in ActiveMQ version 5.2.0. When there are parameters for the connection (e.g.: prefetch policy parameters -"jms.prefetchSize.all", etc-) This issue has to do with the invalid parsing of the URI. > The issue was found when trying to append connection parameters to a failover URI. The problem with this is basically that the failover URI is not a "generic URI" (see RFC 2396 for more details), that is, it is not of the form: > ://? > Although the URI is composed of > : > and is thus a valid URI according to the RFC. > The method > URISupport.createURIWithQuery(URI, String) > return and incorrect URI for a failover URI, because of the scheme of this URI. This is the content of the method: > <<< CODE > URISupport.createURIWithQuery(URI, String){ > return new URI(uri.getScheme(), uri.getUserInfo(), uri.getHost(), uri.getPort(), uri.getPath(), query, uri.getFragment()); > } > <<< /CODE > When parsing the URI in ActiveMQConnectionFactory.createURI(String) with: > new java.util.URI(String) > The resulting URI has some missing or "invalid" values. For instance, with the following URL: > "failover://(tcp://host:port)?jms.prefetchSize.all=30" > the resulting URI has the following values set: > host=null > port=-1 > authority="(tcp:" > path="//host:port)" > query="connectionParameter=value" > the path gets its value because of the "/" after "(tcp:". > The result is that when > ActiveMQConnectionFacotry.setBrokerURL(String) Line 343: > <<< CODE > this.brokerURL = URISupport.createRemainingURI(this.brokerURL, map); > <<< /CODE > is excecuted, an exeption is thrown (message="Illegal character in port number"), because of the invalid por number. > This is silently ignored in the ActiveMQConnectionFactory.setBroker(Strin) method and the values of the brokerURL are not updated without the connection parameters. > Consecuently, when the connection is created, the following exception is thrown: > java.lang.IllegalArgumentException "Invalid connect parameters: ..." > Because of the connectionParameter that was not removed from the brokerURL. > 2) The second URI pattern causes failover paramters to be ignored but the tcp transport gets the correct parameters. > The resulting URI in ActiveMQConnectionFactory contains the following invalid values: > host=null > port=-1 > authority="(tcp:" > path="//host:port" > query="tcpParameter=value)?failoverParamater=value" > this is because of the extra ? in the "nested" URI. > This URI works correctly, but if a connection parameter is the first parameter in the composite URI as in (3): > failover://(tcp://host:port?tcpParameter=value1)?connectionParamater=value2&failoverParameter=value3 > that parameter would be omited, and the failover transport would fail when connecting because of an invalid connection parameter being set for the failover transport. > Conclusion: > A modification of the parsing in > ActiveMQConnectionFactory.setBrokerURL(String) > should solve the query parameter problems. > The parameter parsing should consider the nested URIs, and the call to > URISupport.createRemainingURI(URI, Map); > should create a "nested" URI (composite) if required. > Some other modification could also be required. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.