changeset 1457:bd118814ce2e

2009-03-31 Omair Majid <omajid@redhat.com> * patches/icedtea-network-unreachable.patch: New file. Check for EHOSTUNREACH and ENETUNREACH early on when establishing a connection. * Makefile.am (ICEDTEA_PATCHES): Apply the above. * HACKING: Document the above.
author Omair Majid <omajid@redhat.com>
date Tue, 31 Mar 2009 14:43:02 -0400
parents a537113b9d22
children 422763ad5d3c
files ChangeLog HACKING Makefile.am patches/icedtea-network-unreachable.patch
diffstat 4 files changed, 40 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Mar 31 14:03:24 2009 -0400
+++ b/ChangeLog	Tue Mar 31 14:43:02 2009 -0400
@@ -1,3 +1,10 @@
+2009-03-31  Omair Majid  <omajid@redhat.com>
+
+	* patches/icedtea-network-unreachable.patch: New file. Check for
+	EHOSTUNREACH and ENETUNREACH early on when establishing a connection.
+	* Makefile.am (ICEDTEA_PATCHES): Apply the above.
+	* HACKING: Document the above. 
+
 2009-03-31  Omair Majid  <omajid@redhat.com>
 
 	* patches/icedtea-jtreg-printjob-multiple-end.patch: New patch. Dont
--- a/HACKING	Tue Mar 31 14:03:24 2009 -0400
+++ b/HACKING	Tue Mar 31 14:43:02 2009 -0400
@@ -91,6 +91,7 @@
 * icedtea-jtreg-dnd.patch: Fix classpath issues in java/awt/dnd/FileListBetweenJVMsTest.
 * icedtea-jtreg-colortest.patch: Remove call to System.exit() that was causing SystemBgColorTest to fail.
 * icedtea-jtreg-printjob-multiple-end.patch: Fix test to not require any user interaction.
+* icedtea-network-unreachable.patch: Check for ENETUNREACH and EHOSTUNREACH early on when doing a Socket.connect().
 
 The following patches are only applied to OpenJDK6 in IcedTea6:
 
--- a/Makefile.am	Tue Mar 31 14:03:24 2009 -0400
+++ b/Makefile.am	Tue Mar 31 14:43:02 2009 -0400
@@ -690,6 +690,7 @@
 	patches/icedtea-jtreg-dnd.patch \
 	patches/icedtea-jtreg-colortest.patch \
 	patches/icedtea-jtreg-printjob-multiple-end.patch \
+	patches/icedtea-network-unreachable.patch \
 	$(DISTRIBUTION_PATCHES)
 
 stamps/extract.stamp: stamps/download.stamp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/icedtea-network-unreachable.patch	Tue Mar 31 14:43:02 2009 -0400
@@ -0,0 +1,31 @@
+--- openjdk/jdk/src/solaris/native/java/net/PlainSocketImpl.c.orig	2008-11-25 04:06:19.000000000 -0500
++++ openjdk/jdk/src/solaris/native/java/net/PlainSocketImpl.c	2009-03-20 16:58:35.000000000 -0400
+@@ -410,8 +410,16 @@
+             jlong prevTime = JVM_CurrentTimeMillis(env, 0);
+ 
+             if (errno != EINPROGRESS) {
+-                NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "ConnectException",
+-                             "connect failed");
++                if (errno == EHOSTUNREACH) {
++                    NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "NoRouteToHostException",
++                           "Host unreachable");
++                } else if (errno == ENETUNREACH) {
++                    NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "NoRouteToHostException",
++                           "Network unreachable");
++                } else {
++                    NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "ConnectException",
++                           "connect failed");
++                }
+                 SET_BLOCKING(fd);
+                 return;
+             }
+@@ -540,6 +548,9 @@
+         } else if (errno == EHOSTUNREACH) {
+             NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "NoRouteToHostException",
+                            "Host unreachable");
++        } else if (errno == ENETUNREACH) {
++            NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "NoRouteToHostException",
++                           "Network unreachable");
+         } else if (errno == EADDRNOTAVAIL) {
+             NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "NoRouteToHostException",
+                              "Address not available");