8218280: LineNumberReader throws "Mark invalid" exception if CRLF straddles buffer.

Brian Burkhalter brian.burkhalter at oracle.com
Fri Apr 26 01:20:31 UTC 2019

For issue [1] please review the patch [2].

The source change merely changes mark() to use a read ahead limit one value larger than the parameter if the most recently read character is a ‘\r’ (carriage return). In this case if the next character in the stream is a ‘\n’ (line feed), the next read() would actually consume two characters instead of one. The incremented read ahead limit compensates for this.

The two sub-tests of the test both fail without the implementation change and succeed with it.



[1] https://bugs.openjdk.java.net/browse/JDK-8218280 <https://bugs.openjdk.java.net/browse/JDK-8218280>
[2] http://cr.openjdk.java.net/~bpb/8218280/webrev.00/

More information about the core-libs-dev mailing list