提交 e8093d98 编写于 作者: B bpb

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

Summary: Modify UHE exception message for EAI_AGAIN failures.
Reviewed-by: alanb, chegar, michaelm, dsamersoff
Contributed-by: NBrian Burkhalter <brian.burkhalter@oracle.com>
上级 e46e6a6d
...@@ -178,8 +178,7 @@ Java_java_net_Inet4AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this, ...@@ -178,8 +178,7 @@ Java_java_net_Inet4AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this,
if (error) { if (error) {
/* report error */ /* report error */
JNU_ThrowByName(env, JNU_JAVANETPKG "UnknownHostException", ThrowUnknownHostExceptionWithGaiError(env, hostname, error);
(char *)hostname);
JNU_ReleaseStringPlatformChars(env, host, hostname); JNU_ReleaseStringPlatformChars(env, host, hostname);
return NULL; return NULL;
} else { } else {
......
...@@ -241,6 +241,10 @@ Java_java_net_Inet4AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this, ...@@ -241,6 +241,10 @@ Java_java_net_Inet4AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this,
addrp++; addrp++;
i++; i++;
} }
} else if (WSAGetLastError() == WSATRY_AGAIN) {
NET_ThrowByNameWithLastError(env,
JNU_JAVANETPKG "UnknownHostException",
hostname);
} else { } else {
JNU_ThrowByName(env, JNU_JAVANETPKG "UnknownHostException", hostname); JNU_ThrowByName(env, JNU_JAVANETPKG "UnknownHostException", hostname);
} }
......
...@@ -131,7 +131,13 @@ Java_java_net_Inet6AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this, ...@@ -131,7 +131,13 @@ Java_java_net_Inet6AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this,
error = getaddrinfo(hostname, NULL, &hints, &res); 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 */ /* report error */
JNU_ThrowByName(env, JNU_JAVANETPKG "UnknownHostException", JNU_ThrowByName(env, JNU_JAVANETPKG "UnknownHostException",
(char *)hostname); (char *)hostname);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册