OutputStreamWriter.java: (flush, writeChars): Throw IOException if stream closed.
authorBryce McKinlay <bryce@albatross.co.nz>
Fri, 9 Feb 2001 04:01:59 +0000 (04:01 +0000)
committerBryce McKinlay <bryce@gcc.gnu.org>
Fri, 9 Feb 2001 04:01:59 +0000 (04:01 +0000)
* java/io/OutputStreamWriter.java: (flush, writeChars): Throw
IOException if stream closed.

From-SVN: r39559

libjava/ChangeLog
libjava/java/io/OutputStreamWriter.java

index 981c0ed64c17b425941637f2dc9ff114b5a63bb8..6848231aa96699d49610a76b79a34420e31b58c5 100644 (file)
@@ -9,6 +9,9 @@
        * java/lang/Float.java: As above.
        (floatToRawIntBits): New method.
 
+       * java/io/OutputStreamWriter.java: (flush, writeChars): Throw 
+       IOException if stream closed.
+
 2001-02-08  Tom Tromey  <tromey@redhat.com>
 
        * java/lang/Float.java (parseFloat): New method.
index e888c66a52e374cf77eebdc8bcd0b0e582790c90..41275985beafbecdd9c0b81250d3993fa41f547a 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 1999, 2000  Free Software Foundation
+/* Copyright (C) 1998, 1999, 2000, 2001  Free Software Foundation
 
    This file is part of libgcj.
 
@@ -69,6 +69,9 @@ public class OutputStreamWriter extends Writer
   {
     synchronized (lock)
       {
+       if (out == null)
+         throw new IOException("Stream closed");
+
        if (wcount > 0)
          {
            writeChars(work, 0, wcount);
@@ -97,6 +100,9 @@ public class OutputStreamWriter extends Writer
   private void writeChars(char[] buf, int offset, int count)
     throws IOException
   {
+    if (out == null)
+      throw new IOException("Stream closed");
+  
     while (count > 0)
       {
        // We must flush if out.count == out.buf.length.