* gnu/java/net/natPlainDatagramSocketImplPosix.cc

(peekData): Throw SocketTimeoutException instead of
	InterruptedIOException on timeout.
	(receive): Likewise.
	* gnu/java/net/natPlainSocketImplPosix.cc
	(read): Made a minor exception text case change.

From-SVN: r74714
This commit is contained in:
Mohan Embar 2003-12-16 22:47:53 +00:00 committed by Mohan Embar
parent 93cbdb1a0c
commit 027e655b6e
3 changed files with 18 additions and 6 deletions

View file

@ -1,3 +1,12 @@
2003-12-16 Mohan Embar <gnustuff@thisiscool.com>
* gnu/java/net/natPlainDatagramSocketImplPosix.cc
(peekData): Throw SocketTimeoutException instead of
InterruptedIOException on timeout.
(receive): Likewise.
* gnu/java/net/natPlainSocketImplPosix.cc
(read): Made a minor exception text case change.
2003-12-16 Michael Koch <konqueror@gmx.de> 2003-12-16 Michael Koch <konqueror@gmx.de>
Fix for PR libgcj/13056. Fix for PR libgcj/13056.

View file

@ -29,6 +29,7 @@ details. */
#include <java/io/InterruptedIOException.h> #include <java/io/InterruptedIOException.h>
#include <java/net/BindException.h> #include <java/net/BindException.h>
#include <java/net/SocketException.h> #include <java/net/SocketException.h>
#include <java/net/SocketTimeoutException.h>
#include <java/net/InetAddress.h> #include <java/net/InetAddress.h>
#include <java/net/NetworkInterface.h> #include <java/net/NetworkInterface.h>
#include <java/net/DatagramPacket.h> #include <java/net/DatagramPacket.h>
@ -225,7 +226,8 @@ gnu::java::net::PlainDatagramSocketImpl::peekData (::java::net::DatagramPacket *
if ((retval = _Jv_select (native_fd + 1, &rset, NULL, NULL, &tv)) < 0) if ((retval = _Jv_select (native_fd + 1, &rset, NULL, NULL, &tv)) < 0)
goto error; goto error;
else if (retval == 0) else if (retval == 0)
throw new ::java::io::InterruptedIOException (); throw new ::java::net::SocketTimeoutException
(JvNewStringUTF ("PeekData timed out") );
} }
retlen = retlen =
@ -345,7 +347,8 @@ gnu::java::net::PlainDatagramSocketImpl::receive (::java::net::DatagramPacket *p
if ((retval = _Jv_select (native_fd + 1, &rset, NULL, NULL, &tv)) < 0) if ((retval = _Jv_select (native_fd + 1, &rset, NULL, NULL, &tv)) < 0)
goto error; goto error;
else if (retval == 0) else if (retval == 0)
throw new ::java::io::InterruptedIOException (); throw new ::java::net::SocketTimeoutException
(JvNewStringUTF ("Receive timed out") );
} }
retlen = retlen =

View file

@ -408,7 +408,7 @@ gnu::java::net::PlainSocketImpl$SocketInputStream::read(void)
// that means we've timed out. // that means we've timed out.
if (sel_retval == 0) if (sel_retval == 0)
throw new ::java::net::SocketTimeoutException throw new ::java::net::SocketTimeoutException
(JvNewStringUTF ("read timed out") ); (JvNewStringUTF ("Read timed out") );
// If select returns ok we know we either got signalled or read some data... // If select returns ok we know we either got signalled or read some data...
// either way we need to try to read. // either way we need to try to read.
} }
@ -422,7 +422,7 @@ gnu::java::net::PlainSocketImpl$SocketInputStream::read(void)
{ {
::java::io::InterruptedIOException *iioe = ::java::io::InterruptedIOException *iioe =
new ::java::io::InterruptedIOException new ::java::io::InterruptedIOException
(JvNewStringUTF("read interrupted")); (JvNewStringUTF("Read interrupted"));
iioe->bytesTransferred = r == -1 ? 0 : r; iioe->bytesTransferred = r == -1 ? 0 : r;
throw iioe; throw iioe;
} }
@ -478,7 +478,7 @@ gnu::java::net::PlainSocketImpl$SocketInputStream::read(jbyteArray buffer, jint
{ {
::java::net::SocketTimeoutException *timeoutException = ::java::net::SocketTimeoutException *timeoutException =
new ::java::net::SocketTimeoutException new ::java::net::SocketTimeoutException
(JvNewStringUTF ("read timed out")); (JvNewStringUTF ("Read timed out"));
throw timeoutException; throw timeoutException;
} }
} }
@ -493,7 +493,7 @@ gnu::java::net::PlainSocketImpl$SocketInputStream::read(jbyteArray buffer, jint
{ {
::java::io::InterruptedIOException *iioe = ::java::io::InterruptedIOException *iioe =
new ::java::io::InterruptedIOException new ::java::io::InterruptedIOException
(JvNewStringUTF ("read interrupted")); (JvNewStringUTF ("Read interrupted"));
iioe->bytesTransferred = r == -1 ? 0 : r; iioe->bytesTransferred = r == -1 ? 0 : r;
throw iioe; throw iioe;
} }