This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Patch: java.io.PrintStream - PR/13176


On Dec 7, 2003, at 9:08 AM, Michael Koch wrote:

OK. I understand that. I just don't understand why the catching of
InterruptedIOException and the calling Thread.interrupt() is needed in
the above methods, but not in the method were you say you removed it
again. It looks like for example print() can be interrupted, a
InterruptedIOException is thrown from natFileDescriptor who notices
that, but we catch it in print() and just return with as only indication
that something strange happened the fact that Thread.interrupted() will
return true. Is that on purpose?

I dont really know. Perhaps we should ask Bryce. He removed the other ones. I cc'ed him now.

PrintStream methods must catch InterruptedIOException because its a checked exception. On the other hand, the docs for checkError state that "The internal error state is set to true when the underlying output stream throws an IOException other than InterruptedIOException ...". So yes, I think something like the following is right:


--- PrintStream.java    10 Aug 2003 02:53:17 -0000      1.23
+++ PrintStream.java    7 Dec 2003 00:25:35 -0000
@@ -437,7 +437,8 @@
       }
     catch (IOException e)
       {
-        setError ();
+        if (! (e instanceof InterruptedIOException))
+          setError ();
       }
   }

@@ -464,7 +465,8 @@
       }
     catch (IOException e)
       {
-        setError ();
+        if (! (e instanceof InterruptedIOException))
+          setError ();
       }
   }
 } // class PrintStream

I don't think we want to call Thread.interrupt() again, though.

Regards

Bryce.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]