diff --git a/jdk/src/solaris/native/java/net/Inet4AddressImpl.c b/jdk/src/solaris/native/java/net/Inet4AddressImpl.c index 9a4d32ebf96..44f3b7aa4a5 100644 --- a/jdk/src/solaris/native/java/net/Inet4AddressImpl.c +++ b/jdk/src/solaris/native/java/net/Inet4AddressImpl.c @@ -178,8 +178,7 @@ Java_java_net_Inet4AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this, if (error) { /* report error */ - JNU_ThrowByName(env, JNU_JAVANETPKG "UnknownHostException", - (char *)hostname); + ThrowUnknownHostExceptionWithGaiError(env, hostname, error); JNU_ReleaseStringPlatformChars(env, host, hostname); return NULL; } else { diff --git a/jdk/src/windows/native/java/net/Inet4AddressImpl.c b/jdk/src/windows/native/java/net/Inet4AddressImpl.c index d7cf8e5a395..97aab6f9c14 100644 --- a/jdk/src/windows/native/java/net/Inet4AddressImpl.c +++ b/jdk/src/windows/native/java/net/Inet4AddressImpl.c @@ -241,6 +241,10 @@ Java_java_net_Inet4AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this, addrp++; i++; } + } else if (WSAGetLastError() == WSATRY_AGAIN) { + NET_ThrowByNameWithLastError(env, + JNU_JAVANETPKG "UnknownHostException", + hostname); } else { JNU_ThrowByName(env, JNU_JAVANETPKG "UnknownHostException", hostname); } diff --git a/jdk/src/windows/native/java/net/Inet6AddressImpl.c b/jdk/src/windows/native/java/net/Inet6AddressImpl.c index c124f91f4d5..0e6fc308a44 100644 --- a/jdk/src/windows/native/java/net/Inet6AddressImpl.c +++ b/jdk/src/windows/native/java/net/Inet6AddressImpl.c @@ -131,7 +131,13 @@ Java_java_net_Inet6AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this, error = getaddrinfo(hostname, NULL, &hints, &res); - if (error) { + if (WSAGetLastError() == WSATRY_AGAIN) { + NET_ThrowByNameWithLastError(env, + JNU_JAVANETPKG "UnknownHostException", + hostname); + JNU_ReleaseStringPlatformChars(env, host, hostname); + return NULL; + } else if (error) { /* report error */ JNU_ThrowByName(env, JNU_JAVANETPKG "UnknownHostException", (char *)hostname);