summaryrefslogtreecommitdiff
path: root/libjava/gnu
diff options
context:
space:
mode:
authortromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2006-04-20 15:46:40 +0000
committertromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2006-04-20 15:46:40 +0000
commiteeb5db42a188a2a7b564acfe23775ce6ae9bb1b6 (patch)
tree6466a6a7c75e3c84b76b1f5c41080183ef02f6c6 /libjava/gnu
parente259be194249596ba49c7fa3fbc8589ec4ab15d2 (diff)
downloadgcc-eeb5db42a188a2a7b564acfe23775ce6ae9bb1b6.tar.gz
PR libgcj/21941:
* gnu/java/net/natPlainDatagramSocketImplPosix.cc (send): Throw UnknownHostException if needed. * gnu/java/net/natPlainSocketImplPosix.cc (connect): Throw UnknownHostException if needed. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@113118 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/gnu')
-rw-r--r--libjava/gnu/java/net/natPlainDatagramSocketImplPosix.cc9
-rw-r--r--libjava/gnu/java/net/natPlainSocketImplPosix.cc8
2 files changed, 13 insertions, 4 deletions
diff --git a/libjava/gnu/java/net/natPlainDatagramSocketImplPosix.cc b/libjava/gnu/java/net/natPlainDatagramSocketImplPosix.cc
index ada5fd160c5..96b374db5f5 100644
--- a/libjava/gnu/java/net/natPlainDatagramSocketImplPosix.cc
+++ b/libjava/gnu/java/net/natPlainDatagramSocketImplPosix.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2005 Free Software Foundation
+/* Copyright (C) 2003, 2005, 2006 Free Software Foundation
This file is part of libgcj.
@@ -38,6 +38,7 @@ details. */
#include <java/lang/Object.h>
#include <java/lang/Boolean.h>
#include <java/lang/Integer.h>
+#include <java/net/UnknownHostException.h>
union SockAddr
{
@@ -291,7 +292,11 @@ gnu::java::net::PlainDatagramSocketImpl::send (::java::net::DatagramPacket *p)
// FIXME: Deal with Multicast and if the socket is connected.
jint rport = p->getPort();
union SockAddr u;
- jbyteArray haddress = p->getAddress()->addr;
+ ::java::net::InetAddress *host = p->getAddress();
+ if (! host)
+ throw new ::java::net::UnknownHostException(p->toString());
+
+ jbyteArray haddress = host->addr;
jbyte *bytes = elements (haddress);
int len = haddress->length;
struct sockaddr *ptr = (struct sockaddr *) &u.address;
diff --git a/libjava/gnu/java/net/natPlainSocketImplPosix.cc b/libjava/gnu/java/net/natPlainSocketImplPosix.cc
index be9437cd7db..28707db4de8 100644
--- a/libjava/gnu/java/net/natPlainSocketImplPosix.cc
+++ b/libjava/gnu/java/net/natPlainSocketImplPosix.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004, 2005 Free Software Foundation
+/* Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation
This file is part of libgcj.
@@ -51,6 +51,7 @@ details. */
#include <java/lang/NullPointerException.h>
#include <java/lang/ArrayIndexOutOfBoundsException.h>
#include <java/lang/IllegalArgumentException.h>
+#include <java/net/UnknownHostException.h>
union SockAddr
{
@@ -136,10 +137,13 @@ gnu::java::net::PlainSocketImpl::bind (::java::net::InetAddress *host, jint lpor
void
gnu::java::net::PlainSocketImpl::connect (::java::net::SocketAddress *addr,
- jint timeout)
+ jint timeout)
{
::java::net::InetSocketAddress *tmp = (::java::net::InetSocketAddress*) addr;
::java::net::InetAddress *host = tmp->getAddress();
+ if (! host)
+ throw new ::java::net::UnknownHostException(tmp->toString());
+
jint rport = tmp->getPort();
// Set the SocketImpl's address and port fields before we try to