Fix for AMQ-1188 to handle invalid URIs for host names on Linux

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@515084 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
James Strachan 2007-03-06 11:47:32 +00:00
parent 4bef5e3599
commit 8011f907ef
1 changed files with 10 additions and 2 deletions

View File

@ -91,8 +91,16 @@ public class TcpTransportServer extends TransportServerThreadSupport {
setConnectURI(new URI(bind.getScheme(), bind.getUserInfo(), resolveHostName(bind.getHost()), serverSocket.getLocalPort(), bind.getPath(),
bind.getQuery(), bind.getFragment()));
} catch (URISyntaxException e) {
throw IOExceptionSupport.create(e);
}
// it could be that the host name contains invalid characters such as _ on unix platforms
// so lets try use the IP address instead
try {
setConnectURI(new URI(bind.getScheme(), bind.getUserInfo(), addr.getHostAddress(), serverSocket.getLocalPort(), bind.getPath(),
bind.getQuery(), bind.getFragment()));
} catch (URISyntaxException e2) {
throw IOExceptionSupport.create(e2);
}
}
}
/**