Author: ron.sigal(a)jboss.com
Date: 2009-12-20 21:23:29 -0500 (Sun, 20 Dec 2009)
New Revision: 5620
Modified:
remoting2/branches/2.2/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.2/src/main/org/jboss/remoting/transport/Connector.java
===================================================================
--- remoting2/branches/2.2/src/main/org/jboss/remoting/transport/Connector.java 2009-12-21
02:16:24 UTC (rev 5619)
+++ remoting2/branches/2.2/src/main/org/jboss/remoting/transport/Connector.java 2009-12-21
02:23:29 UTC (rev 5620)
@@ -529,7 +529,7 @@
int port = clientConnectPort != null ? Integer.parseInt(clientConnectPort)
: serverBindPort != null ? Integer.parseInt(serverBindPort) :
PortUtil.findFreePort(serverBindAddress != null ? serverBindAddress :
InetAddress.getLocalHost().getHostAddress());
// finally, let's bild the invoker uri
- String tempURI = transport + "://" + host + ":" +
port;
+ String tempURI = transport + "://" + fixHostnameForURL(host) +
":" + port;
// append path if there is one
if (path != null)
@@ -572,6 +572,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 configureHandlers()
throws Exception
{
Show replies by date