This fixes PR 29034 by adding an early return for a 0 length read.

Tom

2006-09-13  Tom Tromey  <[EMAIL PROTECTED]>

        PR classpath/29034:
        * java/io/PipedReader.java (read): Return early if len==0.
        * java/io/PipedInputStream.java (read): Return early if len==0.

Index: java/io/PipedInputStream.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/io/PipedInputStream.java,v
retrieving revision 1.20
diff -u -r1.20 PipedInputStream.java
--- java/io/PipedInputStream.java       13 Sep 2005 21:25:08 -0000      1.20
+++ java/io/PipedInputStream.java       13 Sep 2006 17:41:59 -0000
@@ -279,6 +279,10 @@
     if (closed)
       throw new IOException ("Pipe closed");
 
+    // Don't block if nothing was requested.
+    if (len == 0)
+      return 0;
+
     // If the buffer is empty, wait until there is something in the pipe 
     // to read.
     try
Index: java/io/PipedReader.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/io/PipedReader.java,v
retrieving revision 1.17
diff -u -r1.17 PipedReader.java
--- java/io/PipedReader.java    2 Jul 2005 20:32:38 -0000       1.17
+++ java/io/PipedReader.java    13 Sep 2006 17:41:59 -0000
@@ -261,6 +261,10 @@
       if (closed)
        throw new IOException ("Pipe closed");
 
+      // Don't block if nothing was requested.
+      if (len == 0)
+        return 0;
+
       // If the buffer is empty, wait until there is something in the pipe 
       // to read.
       try

Reply via email to