Hi all,

I have a test here that shows that SUN throws a java.net.ConnectException
if a connection to a socket fails (e.g. nothing is listening). GNU classpath
currently throws an IOException.

I have no clue of this C stuff but I tried a first patch :-)

2006-02-05  Wolfgang Baer  <[EMAIL PROTECTED]>

        * native/jni/java-net/javanet.c (_javanet_connect):
        Throw ConnectException instead of IOException if connection failed.
        * native/jni/java-net/javanet.h:
        Add a define for java.net.ConnectException

Does this look correct ?

Wolfgang

Index: native/jni/java-net/javanet.c
===================================================================
RCS file: /cvsroot/classpath/classpath/native/jni/java-net/javanet.c,v
retrieving revision 1.32
diff -u -r1.32 javanet.c
--- native/jni/java-net/javanet.c	25 Jan 2006 10:40:12 -0000	1.32
+++ native/jni/java-net/javanet.c	5 Feb 2006 14:02:53 -0000
@@ -559,7 +559,7 @@
 	  && (TARGET_NATIVE_LAST_ERROR ()
 	      != TARGET_NATIVE_ERROR_INTERRUPT_FUNCTION_CALL))
 	{
-	  JCL_ThrowException (env, IO_EXCEPTION,
+	  JCL_ThrowException (env, CONNECT_EXCEPTION,
 			      TARGET_NATIVE_LAST_ERROR_STRING ());
 	  return;
 	}
Index: native/jni/java-net/javanet.h
===================================================================
RCS file: /cvsroot/classpath/classpath/native/jni/java-net/javanet.h,v
retrieving revision 1.12
diff -u -r1.12 javanet.h
--- native/jni/java-net/javanet.h	25 Jan 2006 10:40:12 -0000	1.12
+++ native/jni/java-net/javanet.h	5 Feb 2006 14:02:53 -0000
@@ -50,6 +50,7 @@
 /* Exception Classes */
 #define BIND_EXCEPTION "java/net/BindException"
 #define IO_EXCEPTION "java/io/IOException"
+#define CONNECT_EXCEPTION "java/net/ConnectException"
 #define SOCKET_EXCEPTION "java/net/SocketException"
 #define UNKNOWN_HOST_EXCEPTION "java/net/UnknownHostException"
 

Reply via email to