8157749: Improve handling of DNS error replies
authormsheppar
Fri, 15 Jul 2016 20:57:41 +0100
changeset 41578 6bc194dea076
parent 41577 d4852d03014f
child 41579 c0fe2e6364d9
8157749: Improve handling of DNS error replies Reviewed-by: chegar, rriggs, coffeys
jdk/src/java.base/unix/native/libnet/net_util_md.c
jdk/src/java.base/windows/native/libnet/net_util_md.c
--- 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