8157749: Improve handling of DNS error replies
Reviewed-by: chegar, rriggs, coffeys
--- a/jdk/src/java.base/unix/native/libnet/net_util_md.c Thu Jul 14 11:55:09 2016 -0700
+++ b/jdk/src/java.base/unix/native/libnet/net_util_md.c Fri Jul 15 20:57:41 2016 +0100
@@ -273,13 +273,10 @@
#endif
-
void
NET_ThrowByNameWithLastError(JNIEnv *env, const char *name,
const char *defaultDetail) {
- char errmsg[255];
- sprintf(errmsg, "errno: %d, error: %s\n", errno, defaultDetail);
- JNU_ThrowByNameWithLastError(env, name, errmsg);
+ JNU_ThrowByNameWithMessageAndLastError(env, name, defaultDetail);
}
void
--- a/jdk/src/java.base/windows/native/libnet/net_util_md.c Thu Jul 14 11:55:09 2016 -0700
+++ b/jdk/src/java.base/windows/native/libnet/net_util_md.c Fri Jul 15 20:57:41 2016 +0100
@@ -205,9 +205,7 @@
void
NET_ThrowByNameWithLastError(JNIEnv *env, const char *name,
const char *defaultDetail) {
- char errmsg[255];
- sprintf(errmsg, "errno: %d, error: %s\n", WSAGetLastError(), defaultDetail);
- JNU_ThrowByNameWithLastError(env, name, errmsg);
+ JNU_ThrowByNameWithMessageAndLastError(env, name, defaultDetail);
}
jfieldID