classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cp-patches] Patch: FYI: PR classpath/22689


From: Tom Tromey
Subject: [cp-patches] Patch: FYI: PR classpath/22689
Date: 16 Sep 2005 13:15:39 -0600

I'm checking this in.

This fixes PR 22689.  PrintWriter.checkError has to know whether or
not the stream has already been closed; otherwise it will always
return 'true' for a closed stream.

Tom

Index: ChangeLog
from  Tom Tromey  <address@hidden>
        PR classpath/22689:
        * java/io/PrintWriter.java (closed): New field.
        (checkError): Only flush if stream not closed.
        (close): Set 'closed'.

Index: java/io/PrintWriter.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/io/PrintWriter.java,v
retrieving revision 1.17
diff -u -r1.17 PrintWriter.java
--- java/io/PrintWriter.java    22 Aug 2005 18:55:18 -0000      1.17
+++ java/io/PrintWriter.java    16 Sep 2005 19:19:33 -0000
@@ -70,6 +70,11 @@
    * on this stream.
    */
   private boolean error;
+  
+  /**
+   * Indicates whether or not the stream has been closed.
+   */
+  private boolean closed;
 
   /**
    * This is the underlying <code>Writer</code> we are sending output
@@ -158,7 +163,8 @@
    */
   public boolean checkError()
   {
-    flush();
+    if (! closed)
+      flush();
     return error;
   }
 
@@ -185,7 +191,8 @@
   {
     try
       {
-       out.close();
+        out.close();
+        closed = true;
       }
     catch (IOException ex)
       {




reply via email to

[Prev in Thread] Current Thread [Next in Thread]