bug-classpath
[Top][All Lists]
Advanced

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

[Bug classpath/22895] New: Java NIO: ReadableByteChannel.read() tries to


From: pinskia at gcc dot gnu dot org
Subject: [Bug classpath/22895] New: Java NIO: ReadableByteChannel.read() tries to read to much data
Date: 22 Aug 2005 12:49:15 -0000

The specification says the read(ByteBuffer bb) method should not read more than 
bb.remaining(). However at least for our SocketChannel implementation this is 
not provided.



A testcase may be written this way



// A channel that is know to have data in it

ReadableByteChannel rbc = ...



// some ByteBuffer (may be direct or not)

ByteBuffer bb = ...



// fills it to the max

while(bb.hasRemaining()) {

    bb.put((byte) 12);

}



int read = -1;

boolean exceptionThrown = false;



try {

  read = rbc.read(bb);

} catch(Exception e) {

  exceptionThrown = true;

}



harness.check(read, 0);

harness.check(exceptionThrown, false);



Then we just need to create all kinds of ReadableByteChannel implmentations and 
run this against this framework.
------- Additional Comments From from-classpath at savannah dot gnu dot org  
2005-04-11 19:27 -------
I work on this.

-- 
           Summary: Java NIO: ReadableByteChannel.read() tries to read to
                    much data
           Product: classpath
           Version: unspecified
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: classpath
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: from-classpath at savannah dot gnu dot org
                CC: bug-classpath at gnu dot org


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




reply via email to

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