Mantis - Resin
Viewing Issue Advanced Details
3350 minor always 02-22-09 12:51 07-25-11 15:21
karlgold  
ferg  
normal  
closed 3.1.6  
fixed  
none    
none 4.0.21  
0003350: com.caucho.vfs.BufferedReaderAdapter ignores mark() and reset()
I tried something like the following on a request with some body content:

    char[] buffer = new char[READ_AHEAD_LIMIT];
    BufferedReader reader = request.getReader();
    boolean ready = reader.ready();
    if (ready) {
      reader.mark(READ_AHEAD_LIMIT);
      reader.read(buffer);
      ready = reader.ready(); // result == FALSE
      reader.reset();
      boolean notReady = reader.ready(); // result should be TRUE, but is FALSE
    }

Looking at BufferedReaderAdapter, read() and ready() are delegated to the underlying ReadStream, but mark() and reset() are not. Calling them has not effect on the ReadStream.

Workaround is to wrap the reader obtained from the request in yet another BufferedReader, but it would be better if request.getReader() returned a fully functional BufferedReader.

Notes
(0005398)
ferg   
07-25-11 15:21   
server/1m01