Commit be17b0fc by Warren Levy Committed by Warren Levy

FileInputStream.java (close): Check if the fd is valid.

	* java/io/FileInputStream.java (close): Check if the fd is valid.
	* java/io/RandomAccessFile.java (close): Ditto.
	* java/net/PlainDatagramSocketImpl.java (close): Ditto.
	* java/net/PlainSocketImpl.java (close): Ditto.

From-SVN: r38131
parent cf9f5da0
2000-12-08 Warren Levy <warrenl@redhat.com>
* java/io/FileInputStream.java (close): Check if the fd is valid.
* java/io/RandomAccessFile.java (close): Ditto.
* java/net/PlainDatagramSocketImpl.java (close): Ditto.
* java/net/PlainSocketImpl.java (close): Ditto.
2000-12-06 Tom Tromey <tromey@redhat.com> 2000-12-06 Tom Tromey <tromey@redhat.com>
* java/awt/GridBagConstraints.java: Filled in values for static * java/awt/GridBagConstraints.java: Filled in values for static
......
...@@ -51,11 +51,8 @@ public class FileInputStream extends InputStream ...@@ -51,11 +51,8 @@ public class FileInputStream extends InputStream
public void close() throws IOException public void close() throws IOException
{ {
if (fd == null) if (fd.valid())
return; fd.close();
fd.close();
fd = null;
} }
protected void finalize() throws IOException protected void finalize() throws IOException
......
...@@ -24,7 +24,8 @@ public class RandomAccessFile implements DataOutput, DataInput ...@@ -24,7 +24,8 @@ public class RandomAccessFile implements DataOutput, DataInput
{ {
public void close () throws IOException public void close () throws IOException
{ {
fd.close(); if (fd.valid())
fd.close();
} }
public final FileDescriptor getFD () throws IOException public final FileDescriptor getFD () throws IOException
......
...@@ -79,7 +79,8 @@ class PlainDatagramSocketImpl extends DatagramSocketImpl ...@@ -79,7 +79,8 @@ class PlainDatagramSocketImpl extends DatagramSocketImpl
// we'll catch the IOException here. // we'll catch the IOException here.
try try
{ {
fd.close(); if (fd.valid())
fd.close();
} }
catch (IOException e) catch (IOException e)
{ {
......
...@@ -92,6 +92,7 @@ class PlainSocketImpl extends SocketImpl ...@@ -92,6 +92,7 @@ class PlainSocketImpl extends SocketImpl
protected void close () throws IOException protected void close () throws IOException
{ {
fd.close(); if (fd.valid())
fd.close();
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment