OSDN Git Service

* java/io/OutputStreamWriter.java: (flush, writeChars): Throw
authorbryce <bryce@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 9 Feb 2001 04:01:59 +0000 (04:01 +0000)
committerbryce <bryce@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 9 Feb 2001 04:01:59 +0000 (04:01 +0000)
IOException if stream closed.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@39559 138bc75d-0d04-0410-961f-82ee72b054a4

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

index 981c0ed..6848231 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 e888c66..4127598 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.