8010371: getaddrinfo can fail with EAI_SYSTEM/EAGAIN, causes UnknownHostException to be thrown

Modify UHE exception message for EAI_AGAIN failures.

Reviewed-by: alanb, chegar, michaelm, dsamersoff
This commit is contained in:
Brian Burkhalter 2013-10-15 16:45:04 -07:00 committed by Brian Burkhalter
parent 1f0c182672
commit 3c035b0aac
3 changed files with 12 additions and 3 deletions
jdk/src
solaris/native/java/net
windows/native/java/net

@ -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 {

@ -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);
}

@ -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);