Add workaround for connection problems with IPv6 link-local addresses and jdk < 7. See #267

This commit is contained in:
Norman Maurer 2012-04-17 13:59:35 +02:00
parent 3558eb7042
commit 5a2793e317

View File

@ -35,7 +35,13 @@ public final class SocketUtil {
*
*/
public static InetSocketAddress stripZoneId(InetSocketAddress socketAddress) throws UnknownHostException {
return new InetSocketAddress(socketAddress.getAddress(), socketAddress.getPort());
// If we have a java version which is >= 7 we can just return the given
// InetSocketAddress as this bug only seems
// to exist in java 6 (and maybe also versions before)
if (DetectionUtil.javaVersion() >= 7) {
return socketAddress;
}
return new InetSocketAddress(stripZoneId(socketAddress.getAddress()), socketAddress.getPort());
}
/**