diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 0a95dd50bf9..91f20e77135 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,10 @@ +2000-12-08 Warren Levy + + * 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 * java/awt/GridBagConstraints.java: Filled in values for static diff --git a/libjava/java/io/FileInputStream.java b/libjava/java/io/FileInputStream.java index e5071e40e89..67d4842f4f8 100644 --- a/libjava/java/io/FileInputStream.java +++ b/libjava/java/io/FileInputStream.java @@ -51,11 +51,8 @@ public class FileInputStream extends InputStream public void close() throws IOException { - if (fd == null) - return; - - fd.close(); - fd = null; + if (fd.valid()) + fd.close(); } protected void finalize() throws IOException diff --git a/libjava/java/io/RandomAccessFile.java b/libjava/java/io/RandomAccessFile.java index d054afc2033..9a0bf807202 100644 --- a/libjava/java/io/RandomAccessFile.java +++ b/libjava/java/io/RandomAccessFile.java @@ -24,7 +24,8 @@ public class RandomAccessFile implements DataOutput, DataInput { public void close () throws IOException { - fd.close(); + if (fd.valid()) + fd.close(); } public final FileDescriptor getFD () throws IOException diff --git a/libjava/java/net/PlainDatagramSocketImpl.java b/libjava/java/net/PlainDatagramSocketImpl.java index 9a290dcd0f8..7076ccf31b1 100644 --- a/libjava/java/net/PlainDatagramSocketImpl.java +++ b/libjava/java/net/PlainDatagramSocketImpl.java @@ -79,7 +79,8 @@ class PlainDatagramSocketImpl extends DatagramSocketImpl // we'll catch the IOException here. try { - fd.close(); + if (fd.valid()) + fd.close(); } catch (IOException e) { diff --git a/libjava/java/net/PlainSocketImpl.java b/libjava/java/net/PlainSocketImpl.java index df9d4387d44..49155d942b7 100644 --- a/libjava/java/net/PlainSocketImpl.java +++ b/libjava/java/net/PlainSocketImpl.java @@ -92,6 +92,7 @@ class PlainSocketImpl extends SocketImpl protected void close () throws IOException { - fd.close(); + if (fd.valid()) + fd.close(); } }