[jboss-remoting-commits] JBoss Remoting SVN: r5618 - remoting2/branches/2.x/src/main/org/jboss/remoting/transport.

jboss-remoting-commits at lists.jboss.org jboss-remoting-commits at lists.jboss.org
Sun Dec 20 21:13:43 EST 2009


Author: ron.sigal at jboss.com
Date: 2009-12-20 21:13:43 -0500 (Sun, 20 Dec 2009)
New Revision: 5618

Modified:
   remoting2/branches/2.x/src/main/org/jboss/remoting/transport/Connector.java
Log:
JBREM-1164: Adds brackets around IPv6 host addresses when it creates an InvokerLocator.

Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/Connector.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/Connector.java	2009-12-14 00:10:14 UTC (rev 5617)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/Connector.java	2009-12-21 02:13:43 UTC (rev 5618)
@@ -627,7 +627,7 @@
                                       : localHostAddress;
    
                   // finally, let's build the invoker uri
-                  tempURI = transport + "://" + host + ":" + port;
+                  tempURI = transport + "://" + fixHostnameForURL(host) + ":" + port;
                   if (path != null)
                   {
                      tempURI += "/" + path;
@@ -824,7 +824,7 @@
                                                         ? serverBindAddress
                                                         : localHostAddress);
 
-            tempURI = transport + "://" + host + ":" + port + ((path != null) ? ("/" + path) : "");
+            tempURI = transport + "://" + fixHostnameForURL(host) + ":" + port + ((path != null) ? ("/" + path) : "");
          }
          else
          {
@@ -878,6 +878,18 @@
       }
    }
    
+   // adds enclosing brackets if an IPv6 literal address
+   private String fixHostnameForURL(String address)
+   {
+      if (address == null) 
+         return address ;
+
+      if (address.indexOf(':') != -1 && address.indexOf("[") == -1)
+         return "[" + address + "]" ;
+      else 
+         return address ;
+   }
+   
    private void configureHandlersFromServerConfiguration() throws Exception
    {
       Map handlerMap = serverConfiguration.getInvocationHandlers();



More information about the jboss-remoting-commits mailing list