From: Bryce McKinlay Date: Tue, 5 Sep 2000 21:57:23 +0000 (+0000) Subject: natPlainDatagramSocketImpl.cc: Change various `JvThrow' calls to `throw'. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a3bcdaf9e9ffafbd6b6ae6d5eed5cb776cffec11;p=platform%2Fupstream%2Fgcc.git natPlainDatagramSocketImpl.cc: Change various `JvThrow' calls to `throw'. 2000-09-05 Bryce McKinlay * java/net/natPlainDatagramSocketImpl.cc: Change various `JvThrow' calls to `throw'. (send): Undo last patch. Remove the label only. (mcastGrp): Ditto. * java/net/natPlainSocketImpl.cc: Change various `JvThrow' calls to `throw'. * java/net/natInetAdress.cc: Ditto. From-SVN: r36165 --- diff --git a/libjava/ChangeLog b/libjava/ChangeLog index fec3ae4..9088206 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,14 @@ +2000-09-05 Bryce McKinlay + + * java/net/natPlainDatagramSocketImpl.cc: Change various `JvThrow' + calls to `throw'. + (send): Undo last patch. + Remove the label only. + (mcastGrp): Ditto. + * java/net/natPlainSocketImpl.cc: Change various `JvThrow' calls to + `throw'. + * java/net/natInetAdress.cc: Ditto. + 2000-09-05 Tom Tromey * doc/cni.sgml: Updated from master copy. diff --git a/libjava/java/net/natInetAddress.cc b/libjava/java/net/natInetAddress.cc index 930803e..d8db576 100644 --- a/libjava/java/net/natInetAddress.cc +++ b/libjava/java/net/natInetAddress.cc @@ -256,7 +256,7 @@ java::net::InetAddress::lookup (jstring host, java::net::InetAddress* iaddr, if (ex != NULL) { if (iaddr == NULL || iaddr->address == NULL) - JvThrow (ex); + throw ex; hptr = NULL; } } @@ -268,7 +268,7 @@ java::net::InetAddress::lookup (jstring host, java::net::InetAddress* iaddr, return NULL; } else - JvThrow (new java::net::UnknownHostException(host)); + throw new java::net::UnknownHostException(host); } int count; if (all) diff --git a/libjava/java/net/natPlainDatagramSocketImpl.cc b/libjava/java/net/natPlainDatagramSocketImpl.cc index 78c2c2a..0ea5ab1 100644 --- a/libjava/java/net/natPlainDatagramSocketImpl.cc +++ b/libjava/java/net/natPlainDatagramSocketImpl.cc @@ -60,62 +60,72 @@ extern java::lang::Class IntegerClass; void java::net::PlainDatagramSocketImpl::create () { - JvThrow (new SocketException (JvNewStringLatin1 ("DatagramSocketImpl.create: unimplemented"))); + throw new SocketException ( + JvNewStringLatin1 ("DatagramSocketImpl.create: unimplemented")); } void java::net::PlainDatagramSocketImpl::bind (jint, java::net::InetAddress *) { - JvThrow (new BindException (JvNewStringLatin1 ("DatagramSocketImpl.bind: unimplemented"))); + throw new BindException ( + JvNewStringLatin1 ("DatagramSocketImpl.bind: unimplemented")); } jint java::net::PlainDatagramSocketImpl::peek (java::net::InetAddress *) { - JvThrow (new java::io::IOException (JvNewStringLatin1 ("DatagramSocketImpl.peek: unimplemented"))); + throw new java::io::IOException ( + JvNewStringLatin1 ("DatagramSocketImpl.peek: unimplemented")); } void java::net::PlainDatagramSocketImpl::send (java::net::DatagramPacket *) { - JvThrow (new java::io::IOException (JvNewStringLatin1 ("DatagramSocketImpl.send: unimplemented"))); + throw new java::io::IOException ( + JvNewStringLatin1 ("DatagramSocketImpl.send: unimplemented")); } void java::net::PlainDatagramSocketImpl::receive (java::net::DatagramPacket *) { - JvThrow (new java::io::IOException (JvNewStringLatin1 ("DatagramSocketImpl.receive: unimplemented"))); + throw new java::io::IOException ( + JvNewStringLatin1 ("DatagramSocketImpl.receive: unimplemented")); } void java::net::PlainDatagramSocketImpl::setTimeToLive (jint) { - JvThrow (new java::io::IOException (JvNewStringLatin1 ("DatagramSocketImpl.setTimeToLive: unimplemented"))); + throw new java::io::IOException ( + JvNewStringLatin1 ("DatagramSocketImpl.setTimeToLive: unimplemented")); } jint java::net::PlainDatagramSocketImpl::getTimeToLive () { - JvThrow (new java::io::IOException (JvNewStringLatin1 ("DatagramSocketImpl.getTimeToLive: unimplemented"))); + throw new java::io::IOException ( + JvNewStringLatin1 ("DatagramSocketImpl.getTimeToLive: unimplemented")); } void java::net::PlainDatagramSocketImpl::mcastGrp (java::net::InetAddress *, jboolean) { - JvThrow (new java::io::IOException (JvNewStringLatin1 ("DatagramSocketImpl.mcastGrp: unimplemented"))); + throw new java::io::IOException ( + JvNewStringLatin1 ("DatagramSocketImpl.mcastGrp: unimplemented")); } void java::net::PlainDatagramSocketImpl::setOption (jint, java::lang::Object *) { - JvThrow (new SocketException (JvNewStringLatin1 ("DatagramSocketImpl.setOption: unimplemented"))); + throw new SocketException ( + JvNewStringLatin1 ("DatagramSocketImpl.setOption: unimplemented")); } java::lang::Object * java::net::PlainDatagramSocketImpl::getOption (jint) { - JvThrow (new SocketException (JvNewStringLatin1 ("DatagramSocketImpl.getOption: unimplemented"))); + throw new SocketException ( + JvNewStringLatin1 ("DatagramSocketImpl.getOption: unimplemented")); } #else /* DISABLE_JAVA_NET */ @@ -161,7 +171,7 @@ java::net::PlainDatagramSocketImpl::create () if (sock < 0) { char* strerr = strerror (errno); - JvThrow (new java::net::SocketException (JvNewStringUTF (strerr))); + throw new java::net::SocketException (JvNewStringUTF (strerr)); } fnum = sock; fd = new java::io::FileDescriptor (sock); @@ -214,7 +224,7 @@ java::net::PlainDatagramSocketImpl::bind (jint lport, } error: char* strerr = strerror (errno); - JvThrow (new java::net::BindException (JvNewStringUTF (strerr))); + throw new java::net::BindException (JvNewStringUTF (strerr)); } jint @@ -252,7 +262,7 @@ java::net::PlainDatagramSocketImpl::peek (java::net::InetAddress *i) return rport; error: char* strerr = strerror (errno); - JvThrow (new java::io::IOException (JvNewStringUTF (strerr))); + throw new java::io::IOException (JvNewStringUTF (strerr)); } void @@ -287,6 +297,9 @@ java::net::PlainDatagramSocketImpl::send (java::net::DatagramPacket *p) if (::sendto (fnum, (char *) dbytes, p->getLength(), 0, ptr, len) >= 0) return; + + char* strerr = strerror (errno); + throw new java::io::IOException (JvNewStringUTF (strerr)); } void @@ -311,7 +324,7 @@ java::net::PlainDatagramSocketImpl::receive (java::net::DatagramPacket *p) if ((retval = _Jv_select (fnum + 1, &rset, NULL, NULL, &tv)) < 0) goto error; else if (retval == 0) - JvThrow (new java::io::InterruptedIOException ()); + throw new java::io::InterruptedIOException (); } retlen = @@ -345,7 +358,7 @@ java::net::PlainDatagramSocketImpl::receive (java::net::DatagramPacket *p) return; error: char* strerr = strerror (errno); - JvThrow (new java::io::IOException (JvNewStringUTF (strerr))); + throw new java::io::IOException (JvNewStringUTF (strerr)); } void @@ -358,7 +371,7 @@ java::net::PlainDatagramSocketImpl::setTimeToLive (jint ttl) return; char* strerr = strerror (errno); - JvThrow (new java::io::IOException (JvNewStringUTF (strerr))); + throw new java::io::IOException (JvNewStringUTF (strerr)); } jint @@ -371,7 +384,7 @@ java::net::PlainDatagramSocketImpl::getTimeToLive () return ((int) val) & 0xFF; char* strerr = strerror (errno); - JvThrow (new java::io::IOException (JvNewStringUTF (strerr))); + throw new java::io::IOException (JvNewStringUTF (strerr)); } void @@ -415,8 +428,11 @@ java::net::PlainDatagramSocketImpl::mcastGrp (java::net::InetAddress *inetaddr, else throw new java::net::SocketException (JvNewStringUTF ("invalid length")); - if (::setsockopt (fnum, level, opname, ptr, len) == 0) + if (::setsockopt (fnum, level, opname, ptr, len) != 0) return; + + char* strerr = strerror (errno); + throw new java::io::IOException (JvNewStringUTF (strerr)); } void @@ -443,12 +459,12 @@ java::net::PlainDatagramSocketImpl::setOption (jint optID, switch (optID) { case _Jv_TCP_NODELAY_ : - JvThrow (new java::net::SocketException ( - JvNewStringUTF ("TCP_NODELAY not valid for UDP"))); + throw new java::net::SocketException ( + JvNewStringUTF ("TCP_NODELAY not valid for UDP")); return; case _Jv_SO_LINGER_ : - JvThrow (new java::net::SocketException ( - JvNewStringUTF ("SO_LINGER not valid for UDP"))); + throw new java::net::SocketException ( + JvNewStringUTF ("SO_LINGER not valid for UDP")); return; case _Jv_SO_SNDBUF_ : case _Jv_SO_RCVBUF_ : @@ -458,8 +474,8 @@ java::net::PlainDatagramSocketImpl::setOption (jint optID, if (::setsockopt (fnum, SOL_SOCKET, opt, (char *) &val, val_len) != 0) goto error; #else - JvThrow (new java::lang::InternalError ( - JvNewStringUTF ("SO_RCVBUF/SO_SNDBUF not supported"))); + throw new java::lang::InternalError ( + JvNewStringUTF ("SO_RCVBUF/SO_SNDBUF not supported")); #endif return; case _Jv_SO_REUSEADDR_ : @@ -468,13 +484,13 @@ java::net::PlainDatagramSocketImpl::setOption (jint optID, val_len) != 0) goto error; #else - JvThrow (new java::lang::InternalError ( - JvNewStringUTF ("SO_REUSEADDR not supported"))); + throw new java::lang::InternalError ( + JvNewStringUTF ("SO_REUSEADDR not supported")); #endif return; case _Jv_SO_BINDADDR_ : - JvThrow (new java::net::SocketException ( - JvNewStringUTF ("SO_BINDADDR: read only option"))); + throw new java::net::SocketException ( + JvNewStringUTF ("SO_BINDADDR: read only option")); return; case _Jv_IP_MULTICAST_IF_ : union InAddr u; @@ -521,7 +537,7 @@ java::net::PlainDatagramSocketImpl::setOption (jint optID, error: char* strerr = strerror (errno); - JvThrow (new java::net::SocketException (JvNewStringUTF (strerr))); + throw new java::net::SocketException (JvNewStringUTF (strerr)); } java::lang::Object * @@ -535,13 +551,13 @@ java::net::PlainDatagramSocketImpl::getOption (jint optID) switch (optID) { case _Jv_TCP_NODELAY_ : - JvThrow (new java::net::SocketException ( - JvNewStringUTF ("TCP_NODELAY not valid for UDP"))); + throw new java::net::SocketException ( + JvNewStringUTF ("TCP_NODELAY not valid for UDP")); break; case _Jv_SO_LINGER_ : - JvThrow (new java::net::SocketException ( - JvNewStringUTF ("SO_LINGER not valid for UDP"))); + throw new java::net::SocketException ( + JvNewStringUTF ("SO_LINGER not valid for UDP")); break; case _Jv_SO_RCVBUF_ : case _Jv_SO_SNDBUF_ : @@ -553,8 +569,8 @@ java::net::PlainDatagramSocketImpl::getOption (jint optID) else return new java::lang::Integer (val); #else - JvThrow (new java::lang::InternalError ( - JvNewStringUTF ("SO_RCVBUF/SO_SNDBUF not supported"))); + throw new java::lang::InternalError ( + JvNewStringUTF ("SO_RCVBUF/SO_SNDBUF not supported")); #endif break; case _Jv_SO_BINDADDR_: @@ -589,8 +605,8 @@ java::net::PlainDatagramSocketImpl::getOption (jint optID) goto error; return new java::lang::Boolean (val != 0); #else - JvThrow (new java::lang::InternalError ( - JvNewStringUTF ("SO_REUSEADDR not supported"))); + throw new java::lang::InternalError ( + JvNewStringUTF ("SO_REUSEADDR not supported")); #endif break; case _Jv_IP_MULTICAST_IF_ : @@ -608,8 +624,8 @@ java::net::PlainDatagramSocketImpl::getOption (jint optID) return java::net::InetAddress::getByName (JvNewStringLatin1 (bytes)); #else - JvThrow (new java::net::SocketException ( - JvNewStringUTF ("IP_MULTICAST_IF: not available - no inet_ntoa()"))); + throw new java::net::SocketException ( + JvNewStringUTF ("IP_MULTICAST_IF: not available - no inet_ntoa()")); #endif break; case _Jv_SO_TIMEOUT_ : @@ -621,7 +637,7 @@ java::net::PlainDatagramSocketImpl::getOption (jint optID) error: char* strerr = strerror (errno); - JvThrow (new java::net::SocketException (JvNewStringUTF (strerr))); + throw new java::net::SocketException (JvNewStringUTF (strerr)); } #endif /* DISABLE_JAVA_NET */ diff --git a/libjava/java/net/natPlainSocketImpl.cc b/libjava/java/net/natPlainSocketImpl.cc index 66cbf97..ff7d8a34 100644 --- a/libjava/java/net/natPlainSocketImpl.cc +++ b/libjava/java/net/natPlainSocketImpl.cc @@ -57,43 +57,50 @@ extern java::lang::Class BooleanClass; void java::net::PlainSocketImpl::create (jboolean) { - JvThrow (new java::io::IOException (JvNewStringLatin1 ("SocketImpl.create: unimplemented"))); + throw new java::io::IOException ( + JvNewStringLatin1 ("SocketImpl.create: unimplemented")); } void java::net::PlainSocketImpl::bind (java::net::InetAddress *, jint) { - JvThrow (new BindException (JvNewStringLatin1 ("SocketImpl.bind: unimplemented"))); + throw new BindException ( + JvNewStringLatin1 ("SocketImpl.bind: unimplemented")); } void java::net::PlainSocketImpl::connect (java::net::InetAddress *, jint) { - JvThrow (new ConnectException (JvNewStringLatin1 ("SocketImpl.connect: unimplemented"))); + throw new ConnectException ( + JvNewStringLatin1 ("SocketImpl.connect: unimplemented")); } void java::net::PlainSocketImpl::listen (jint) { - JvThrow (new java::io::IOException (JvNewStringLatin1 ("SocketImpl.listen: unimplemented"))); + throw new java::io::IOException ( + JvNewStringLatin1 ("SocketImpl.listen: unimplemented")); } void java::net::PlainSocketImpl::accept (java::net::PlainSocketImpl *) { - JvThrow (new java::io::IOException (JvNewStringLatin1 ("SocketImpl.accept: unimplemented"))); + throw new java::io::IOException ( + JvNewStringLatin1 ("SocketImpl.accept: unimplemented")); } void java::net::PlainSocketImpl::setOption (jint, java::lang::Object *) { - JvThrow (new SocketException (JvNewStringLatin1 ("SocketImpl.setOption: unimplemented"))); + throw new SocketException ( + JvNewStringLatin1 ("SocketImpl.setOption: unimplemented")); } java::lang::Object * java::net::PlainSocketImpl::getOption (jint) { - JvThrow (new SocketException (JvNewStringLatin1 ("SocketImpl.getOption: unimplemented"))); + throw new SocketException ( + JvNewStringLatin1 ("SocketImpl.getOption: unimplemented")); } #else /* DISABLE_JAVA_NET */ @@ -117,7 +124,7 @@ java::net::PlainSocketImpl::create (jboolean stream) if (sock < 0) { char* strerr = strerror (errno); - JvThrow (new java::io::IOException (JvNewStringUTF (strerr))); + throw new java::io::IOException (JvNewStringUTF (strerr)); } fnum = sock; fd = new java::io::FileDescriptor (sock); @@ -172,7 +179,7 @@ java::net::PlainSocketImpl::bind (java::net::InetAddress *host, jint lport) } error: char* strerr = strerror (errno); - JvThrow (new java::net::BindException (JvNewStringUTF (strerr))); + throw new java::net::BindException (JvNewStringUTF (strerr)); } void @@ -218,7 +225,7 @@ java::net::PlainSocketImpl::connect (java::net::InetAddress *host, jint rport) return; error: char* strerr = strerror (errno); - JvThrow (new java::net::ConnectException (JvNewStringUTF (strerr))); + throw new java::net::ConnectException (JvNewStringUTF (strerr)); } void @@ -227,7 +234,7 @@ java::net::PlainSocketImpl::listen (jint backlog) if (::listen (fnum, backlog) != 0) { char* strerr = strerror (errno); - JvThrow (new java::io::IOException (JvNewStringUTF (strerr))); + throw new java::io::IOException (JvNewStringUTF (strerr)); } } @@ -251,8 +258,8 @@ java::net::PlainSocketImpl::accept (java::net::PlainSocketImpl *s) if ((retval = _Jv_select (fnum + 1, &rset, NULL, NULL, &tv)) < 0) goto error; else if (retval == 0) - JvThrow (new java::io::InterruptedIOException ( - JvNewStringUTF("Accept timed out"))); + throw new java::io::InterruptedIOException ( + JvNewStringUTF("Accept timed out")); } new_socket = ::accept (fnum, (sockaddr*) &u, &addrlen); @@ -285,7 +292,7 @@ java::net::PlainSocketImpl::accept (java::net::PlainSocketImpl *s) return; error: char* strerr = strerror (errno); - JvThrow (new java::io::IOException (JvNewStringUTF (strerr))); + throw new java::io::IOException (JvNewStringUTF (strerr)); } void @@ -323,8 +330,8 @@ java::net::PlainSocketImpl::setOption (jint optID, java::lang::Object *value) val_len) != 0) goto error; #else - JvThrow (new java::lang::InternalError ( - JvNewStringUTF ("TCP_NODELAY not supported"))); + throw new java::lang::InternalError ( + JvNewStringUTF ("TCP_NODELAY not supported")); #endif /* TCP_NODELAY */ return; case _Jv_SO_LINGER_ : @@ -336,8 +343,8 @@ java::net::PlainSocketImpl::setOption (jint optID, java::lang::Object *value) sizeof(l_val)) != 0) goto error; #else - JvThrow (new java::lang::InternalError ( - JvNewStringUTF ("SO_LINGER not supported"))); + throw new java::lang::InternalError ( + JvNewStringUTF ("SO_LINGER not supported")); #endif /* SO_LINGER */ return; case _Jv_SO_SNDBUF_ : @@ -348,21 +355,21 @@ java::net::PlainSocketImpl::setOption (jint optID, java::lang::Object *value) if (::setsockopt (fnum, SOL_SOCKET, opt, (char *) &val, val_len) != 0) goto error; #else - JvThrow (new java::lang::InternalError ( - JvNewStringUTF ("SO_RCVBUF/SO_SNDBUF not supported"))); + throw new java::lang::InternalError ( + JvNewStringUTF ("SO_RCVBUF/SO_SNDBUF not supported")); #endif return; case _Jv_SO_BINDADDR_ : - JvThrow (new java::net::SocketException ( - JvNewStringUTF ("SO_BINDADDR: read only option"))); + throw new java::net::SocketException ( + JvNewStringUTF ("SO_BINDADDR: read only option")); return; case _Jv_IP_MULTICAST_IF_ : - JvThrow (new java::net::SocketException ( - JvNewStringUTF ("IP_MULTICAST_IF: not valid for TCP"))); + throw new java::net::SocketException ( + JvNewStringUTF ("IP_MULTICAST_IF: not valid for TCP")); return; case _Jv_SO_REUSEADDR_ : - JvThrow (new java::net::SocketException ( - JvNewStringUTF ("SO_REUSEADDR: not valid for TCP"))); + throw new java::net::SocketException ( + JvNewStringUTF ("SO_REUSEADDR: not valid for TCP")); return; case _Jv_SO_TIMEOUT_ : timeout = val; @@ -373,7 +380,7 @@ java::net::PlainSocketImpl::setOption (jint optID, java::lang::Object *value) error: char* strerr = strerror (errno); - JvThrow (new java::net::SocketException (JvNewStringUTF (strerr))); + throw new java::net::SocketException (JvNewStringUTF (strerr)); } java::lang::Object * @@ -396,8 +403,8 @@ java::net::PlainSocketImpl::getOption (jint optID) else return new java::lang::Boolean (val != 0); #else - JvThrow (new java::lang::InternalError ( - JvNewStringUTF ("TCP_NODELAY not supported"))); + throw new java::lang::InternalError ( + JvNewStringUTF ("TCP_NODELAY not supported")); #endif break; @@ -411,8 +418,8 @@ java::net::PlainSocketImpl::getOption (jint optID) else return new java::lang::Boolean ((__java_boolean)false); #else - JvThrow (new java::lang::InternalError ( - JvNewStringUTF ("SO_LINGER not supported"))); + throw new java::lang::InternalError ( + JvNewStringUTF ("SO_LINGER not supported")); #endif break; case _Jv_SO_RCVBUF_ : @@ -425,8 +432,8 @@ java::net::PlainSocketImpl::getOption (jint optID) else return new java::lang::Integer (val); #else - JvThrow (new java::lang::InternalError ( - JvNewStringUTF ("SO_RCVBUF/SO_SNDBUF not supported"))); + throw new java::lang::InternalError ( + JvNewStringUTF ("SO_RCVBUF/SO_SNDBUF not supported")); #endif break; case _Jv_SO_BINDADDR_: @@ -456,12 +463,12 @@ java::net::PlainSocketImpl::getOption (jint optID) return localAddress; break; case _Jv_IP_MULTICAST_IF_ : - JvThrow (new java::net::SocketException ( - JvNewStringUTF ("IP_MULTICAST_IF: not valid for TCP"))); + throw new java::net::SocketException ( + JvNewStringUTF ("IP_MULTICAST_IF: not valid for TCP")); break; case _Jv_SO_REUSEADDR_ : - JvThrow (new java::net::SocketException ( - JvNewStringUTF ("SO_REUSEADDR: not valid for TCP"))); + throw new java::net::SocketException ( + JvNewStringUTF ("SO_REUSEADDR: not valid for TCP")); break; case _Jv_SO_TIMEOUT_ : return new java::lang::Integer (timeout); @@ -472,7 +479,7 @@ java::net::PlainSocketImpl::getOption (jint optID) error: char* strerr = strerror (errno); - JvThrow (new java::net::SocketException (JvNewStringUTF (strerr))); + throw new java::net::SocketException (JvNewStringUTF (strerr)); } #endif /* DISABLE_JAVA_NET */