Return-Path: Delivered-To: apmail-activemq-dev-archive@www.apache.org Received: (qmail 35488 invoked from network); 26 Feb 2011 15:56:24 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 26 Feb 2011 15:56:24 -0000 Received: (qmail 59148 invoked by uid 500); 26 Feb 2011 15:56:24 -0000 Delivered-To: apmail-activemq-dev-archive@activemq.apache.org Received: (qmail 58970 invoked by uid 500); 26 Feb 2011 15:56:22 -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 58961 invoked by uid 99); 26 Feb 2011 15:56:22 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 26 Feb 2011 15:56:22 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 26 Feb 2011 15:56:19 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id C26971B78ED for ; Sat, 26 Feb 2011 15:55:58 +0000 (UTC) Date: Sat, 26 Feb 2011 15:55:58 +0000 (UTC) From: "Timothy Bish (JIRA)" To: dev@activemq.apache.org Message-ID: <144397718.180.1298735758777.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] Closed: (AMQ-2256) Unnecessary TcpTransportFactory NumberFormatException and warning MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/AMQ-2256?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Timothy Bish closed AMQ-2256. ----------------------------- Resolution: Incomplete Fix Version/s: (was: 5.5.0) Not enough information provided to construct a test case. Can be reopened if a test case is provided so this can be validated. > Unnecessary TcpTransportFactory NumberFormatException and warning > ----------------------------------------------------------------- > > Key: AMQ-2256 > URL: https://issues.apache.org/jira/browse/AMQ-2256 > Project: ActiveMQ > Issue Type: Bug > Components: Transport > Affects Versions: 5.2.0 > Environment: Windows XP > Reporter: Scott Lewis > > When executing TcpTransportFactory.createTransport(URI location, WireFormat wf) the following warning is incorrectly generated: > WARNING: path isn't a valid local location for TcpTransport to use > java.lang.NumberFormatException: For input string: "/exampleTopic" > at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48) > at java.lang.Integer.parseInt(Integer.java:447) > at java.lang.Integer.parseInt(Integer.java:497) > at org.apache.activemq.transport.tcp.TcpTransportFactory.createTransport(TcpTransportFactory.java:125) > at org.apache.activemq.transport.TransportFactory.doConnect(TransportFactory.java:141) > at org.apache.activemq.transport.TransportFactory.doConnect(TransportFactory.java:51) > at org.apache.activemq.transport.TransportFactory.connect(TransportFactory.java:80) > at org.apache.activemq.ActiveMQConnectionFactory.createTransport(ActiveMQConnectionFactory.java:237) > at org.apache.activemq.ActiveMQConnectionFactory.createActiveMQConnection(ActiveMQConnectionFactory.java:252) > at org.apache.activemq.ActiveMQConnectionFactory.createActiveMQConnection(ActiveMQConnectionFactory.java:224) > at org.apache.activemq.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:172) > ... > With the topic name set to "/exampleTopic" > The code responsible for this looks like: > URI localLocation = null; > String path = location.getPath(); > // see if the path is a local URI location > if (path != null && path.length() > 0) { > int localPortIndex = path.indexOf(':'); > try { > Integer.parseInt(path.substring(localPortIndex + 1, path.length())); > String localString = location.getScheme() + ":/" + path; > localLocation = new URI(localString); > } catch (Exception e) { > LOG.warn("path isn't a valid local location for TcpTransport to use", e); > } > } > SocketFactory socketFactory = createSocketFactory(); > return createTcpTransport(wf, socketFactory, location, localLocation); > } > The problem seems to be that for the path="/exampleTopic", the following line: > int localPortIndex = path.indexOf(':'); > returns -1 (no colon and no port specified in path > and the subsequent line: > Integer.parseInt(path.substring(localPortIndex + 1, path.length())); > > generates the NumberFormatException (because the path does not have any integer). > It seems that perhaps there should be some test like: > if (localPortIndex != -1) { > ... > } > I will create a patch if desired. Just LMK. -- This message is automatically generated by JIRA. - For more information on JIRA, see: http://www.atlassian.com/software/jira