bug-classpath
[Top][All Lists]
Advanced

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

[Bug classpath/29034] New: PipedInputStream blocks on read(new byte[0])


From: henrik dot togeby at sagemdenmark dot dk
Subject: [Bug classpath/29034] New: PipedInputStream blocks on read(new byte[0]) when empty
Date: 12 Sep 2006 12:19:21 -0000

PipedInputStream.read(new byte[0]) blocks if no data is available, it was
expected to return immediately with return code '0'.

To reproduce:
PipedInputStream pipedInputStream = new PipedInputStream();
new PipedOutputStream(pipedInputStream);      
pipedInputStream.read(new byte[0]);

possible solution:
check len = 0 before waiting in PipedOutputStream.read(byte[],int,int)

workaround:
dont call read with length 0

This probably applies to PipedReader aswell.

Note the javadoc states "This method will block if no bytes are available to be
read.", however so does the javadoc for java.io.InputStream.read(byte[], int,
int) also say, but it doesnt block on read length 0.


-- 
           Summary: PipedInputStream blocks on read(new byte[0]) when empty
           Product: classpath
           Version: 0.92
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: classpath
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: henrik dot togeby at sagemdenmark dot dk


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29034





reply via email to

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