This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Patch: Suppress MingW Build-Busting Net Code


Hi Patch Folks,

Taking the tact that something is better than nothing, this patch
#ifdefs out net code which currently breaks the MingW build. The same
problem of BSD/Windows Sockets incompatibilities in java.net is
rearing its head in the java.nio.channels package. Given that the
consensus seemed to be to split out the code in java.net, shouldn't
the same approach be followed in gnu.java.nio?

I know the #ifdefs are ugly, but they currently run rampant in
java.net and they unbreak the MingW build while waiting for the
glorious day that we properly split out the code. Your call....

Enjoy.

-- Mohan
http://www.thisiscool.com/
http://www.animalsong.org/

ChangeLog
2003-03-07  Mohan Embar  <gnustuff at thisiscool dot com>

	* gnu/java/nio/natSelectorImpl.cc (java_do_select): #ifdef
	out functionality not implemented under mingw (_Jv_select())
	* java/net/natPlainDatagramSocketImpl.cc (peek): #ifdef
	out code that breaks mingw build (ECONNREFUSED)
	(peekData): idem
	(send): idem
	(receive): idem

Index: gnu/java/nio/natSelectorImpl.cc
===================================================================
RCS file: /cvsroot/gcc/gcc/libjava/gnu/java/nio/natSelectorImpl.cc,v
retrieving revision 1.1
diff -u -2 -r1.1 natSelectorImpl.cc
--- gnu/java/nio/natSelectorImpl.cc	29 Nov 2002 07:56:58 -0000	1.1
+++ gnu/java/nio/natSelectorImpl.cc	8 Mar 2003 02:34:11 -0000
@@ -81,4 +81,8 @@
                                               jintArray except, jlong timeout)
 {
+#ifdef WIN32
+  throw new ::java::io::IOException (JvNewStringUTF ("java.nio.channels.Selector.select() not implemented"));
+  return -1;
+#else
   jint result;
   int max_fd = 0;
@@ -124,3 +128,4 @@
 
   return result;
+#endif
 }
Index: java/net/natPlainDatagramSocketImpl.cc
===================================================================
RCS file: /cvsroot/gcc/gcc/libjava/java/net/natPlainDatagramSocketImpl.cc,v
retrieving revision 1.52
diff -u -2 -r1.52 natPlainDatagramSocketImpl.cc
--- java/net/natPlainDatagramSocketImpl.cc	26 Nov 2002 20:09:28 -0000	1.52
+++ java/net/natPlainDatagramSocketImpl.cc	8 Mar 2003 02:34:16 -0000
@@ -311,6 +311,10 @@
   char* strerr = strerror (errno);
 
+#ifndef WIN32
   if (errno == ECONNREFUSED)
     throw new PortUnreachableException (JvNewStringUTF (strerr));
+    // FIXME: On Win32, commenting this out means that for now,
+    // the wrong kind of exception is thrown.
+#endif
 
   throw new java::io::IOException (JvNewStringUTF (strerr));
@@ -378,6 +382,10 @@
   char* strerr = strerror (errno);
 
+#ifndef WIN32
   if (errno == ECONNREFUSED)
     throw new PortUnreachableException (JvNewStringUTF (strerr));
+    // FIXME: On Win32, commenting this out means that for now,
+    // the wrong kind of exception is thrown.
+#endif
 
   throw new java::io::IOException (JvNewStringUTF (strerr));
@@ -433,6 +441,10 @@
   char* strerr = strerror (errno);
 
+#ifndef WIN32
   if (errno == ECONNREFUSED)
     throw new PortUnreachableException (JvNewStringUTF (strerr));
+    // FIXME: On Win32, commenting this out means that for now,
+    // the wrong kind of exception is thrown.
+#endif
 
   throw new java::io::IOException (JvNewStringUTF (strerr));
@@ -500,6 +512,10 @@
   char* strerr = strerror (errno);
 
+#ifndef WIN32
   if (errno == ECONNREFUSED)
     throw new PortUnreachableException (JvNewStringUTF (strerr));
+    // FIXME: On Win32, commenting this out means that for now,
+    // the wrong kind of exception is thrown.
+#endif
 
   throw new java::io::IOException (JvNewStringUTF (strerr));





Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]