DatagramSocket.java (DatagramSocket(int, InetAddress)): Default to using PlainDatagramSocketImpl.
* java/net/DatagramSocket.java (DatagramSocket(int, InetAddress)): Default to using PlainDatagramSocketImpl. * java/net/PlainDatagramSocketImpl.java (close): Catch IOException. From-SVN: r28195
This commit is contained in:
parent
ce96455a31
commit
33551dfec5
@ -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>
|
1999-07-19 Tom Tromey <tromey@cygnus.com>
|
||||||
|
|
||||||
* include/stamp-h.in: New file.
|
* include/stamp-h.in: New file.
|
||||||
|
@ -47,9 +47,19 @@ public class DatagramSocket
|
|||||||
|
|
||||||
String propVal = System.getProperty("impl.prefix");
|
String propVal = System.getProperty("impl.prefix");
|
||||||
if (propVal == null || propVal.equals(""))
|
if (propVal == null || propVal.equals(""))
|
||||||
propVal = "Plain";
|
impl = new PlainDatagramSocketImpl();
|
||||||
impl = (DatagramSocketImpl) Class.forName("java.net." + propVal +
|
else
|
||||||
|
try
|
||||||
|
{
|
||||||
|
impl = (DatagramSocketImpl) Class.forName("java.net." + propVal +
|
||||||
"DatagramSocketImpl").newInstance();
|
"DatagramSocketImpl").newInstance();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
System.err.println("Could not instantiate class: java.net." +
|
||||||
|
propVal + "DatagramSocketImpl");
|
||||||
|
impl = new PlainDatagramSocketImpl();
|
||||||
|
}
|
||||||
impl.create();
|
impl.create();
|
||||||
|
|
||||||
// For multicasting, set the socket to be reused (Stevens pp. 195-6).
|
// For multicasting, set the socket to be reused (Stevens pp. 195-6).
|
||||||
|
@ -68,9 +68,24 @@ class PlainDatagramSocketImpl extends DatagramSocketImpl
|
|||||||
private native void mcastGrp(InetAddress inetaddr, boolean join)
|
private native void mcastGrp(InetAddress inetaddr, boolean join)
|
||||||
throws IOException;
|
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.
|
// Deprecated in JDK 1.2.
|
||||||
|
Loading…
Reference in New Issue
Block a user