summaryrefslogtreecommitdiff
path: root/libjava
diff options
context:
space:
mode:
authorwarrenl <warrenl@138bc75d-0d04-0410-961f-82ee72b054a4>1999-07-20 20:30:42 +0000
committerwarrenl <warrenl@138bc75d-0d04-0410-961f-82ee72b054a4>1999-07-20 20:30:42 +0000
commit4534ad55b05139272139eeedbdf7c11dff5a0aa6 (patch)
treef8547b25c863d8ad2e1ae11a1bcc4aca6c0a8b09 /libjava
parent656d1742edb9f173db53df55a091ecac08d44380 (diff)
downloadgcc-4534ad55b05139272139eeedbdf7c11dff5a0aa6.tar.gz
* java/net/DatagramSocket.java (DatagramSocket(int, InetAddress)):
Default to using PlainDatagramSocketImpl. * java/net/PlainDatagramSocketImpl.java (close): Catch IOException. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@28195 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava')
-rw-r--r--libjava/ChangeLog6
-rw-r--r--libjava/java/net/DatagramSocket.java14
-rw-r--r--libjava/java/net/PlainDatagramSocketImpl.java19
3 files changed, 35 insertions, 4 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index 55c384dd99c..9d4e8bcef3a 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,3 +1,9 @@
+1999-07-20 Warren Levy <warrenl@cygnus.com>
+
+ * java/net/DatagramSocket.java (DatagramSocket(int, InetAddress)):
+ Default to using PlainDatagramSocketImpl.
+ * java/net/PlainDatagramSocketImpl.java (close): Catch IOException.
+
1999-07-19 Tom Tromey <tromey@cygnus.com>
* include/stamp-h.in: New file.
diff --git a/libjava/java/net/DatagramSocket.java b/libjava/java/net/DatagramSocket.java
index 96d9555590b..3291efe024a 100644
--- a/libjava/java/net/DatagramSocket.java
+++ b/libjava/java/net/DatagramSocket.java
@@ -47,9 +47,19 @@ public class DatagramSocket
String propVal = System.getProperty("impl.prefix");
if (propVal == null || propVal.equals(""))
- propVal = "Plain";
- impl = (DatagramSocketImpl) Class.forName("java.net." + propVal +
+ impl = new PlainDatagramSocketImpl();
+ else
+ try
+ {
+ impl = (DatagramSocketImpl) Class.forName("java.net." + propVal +
"DatagramSocketImpl").newInstance();
+ }
+ catch (Exception e)
+ {
+ System.err.println("Could not instantiate class: java.net." +
+ propVal + "DatagramSocketImpl");
+ impl = new PlainDatagramSocketImpl();
+ }
impl.create();
// For multicasting, set the socket to be reused (Stevens pp. 195-6).
diff --git a/libjava/java/net/PlainDatagramSocketImpl.java b/libjava/java/net/PlainDatagramSocketImpl.java
index c65809129ba..a20be1cb74d 100644
--- a/libjava/java/net/PlainDatagramSocketImpl.java
+++ b/libjava/java/net/PlainDatagramSocketImpl.java
@@ -68,9 +68,24 @@ class PlainDatagramSocketImpl extends DatagramSocketImpl
private native void mcastGrp(InetAddress inetaddr, boolean join)
throws IOException;
- protected void close() throws IOException
+ protected void close()
{
- fd.close();
+ // FIXME: The close method in each of the DatagramSocket* classes does
+ // not throw an IOException. The issue is that FileDescriptor.close()
+ // in natFileDescriptorPosix.cc can throw one, so we have to catch
+ // it here. It seems that FileDescriptor.close is properly throwing
+ // the IOException on errors since many of the java.io classes depend
+ // on that. This probably requires a bit more research but for now,
+ // we'll catch the IOException here.
+ try
+ {
+ fd.close();
+ }
+ catch (IOException e)
+ {
+ System.err.println("PlainDatagramSocketImpl.close: Error closing - " +
+ e.getMessage());
+ }
}
// Deprecated in JDK 1.2.