This commit breaks a couple of existing compatibility tests for
BufferedReader:

----------------------------------------
java.lang.NullPointerException: buffer is null
at java.io.BufferedReader.read(BufferedReader.java:282)
at
org.apache.harmony.luni.tests.java.io.BufferedReaderTest.test_read_$CII_Exception(BufferedReaderTest.java:382)
at java.lang.reflect.VMReflection.invokeMethod(VMReflection.java)
----------------------------------------

and

----------------------------------------
junit.framework.AssertionFailedError: should throw IOException
at
org.apache.harmony.luni.tests.java.io.BufferedReaderTest.test_reset_IOException(BufferedReaderTest.java:538)
at java.lang.reflect.VMReflection.invokeMethod(VMReflection.java)
----------------------------------------

Regards,
Tim

On 12/Nov/2009 03:25, [email protected] wrote:
> Author: jessewilson
> Date: Thu Nov 12 03:25:52 2009
> New Revision: 835212
> 
> URL: http://svn.apache.org/viewvc?rev=835212&view=rev
> Log:
> Cleanup and bugfix BufferedReader.
> 
> This change includes the following functional changes:
>  - changing read to not clear the mark upon reading EOF. The previous 
> behaviour was incorrect.
>  - changing read(char[], int, int) to use the 'read directly from the source 
> stream' shortcut when the mark has exceeded its limit. Previously we took the 
> shortcut only when the mark was unset.
> 
> And these nonfunctional changes:
>  - rewrote read(char[], int, int). The new revision contains only one call to 
> 'System.arrayCopy' and the related bookkeeping. Previously there was one call 
> before the loop, and another call in the loop.
>  - renamed markpos to mark
>  - renamed marklimit to markLimit
>  - renamed count to end (it isn't a count, it's a position)
>  - renamed fillbuf() to fillBuf()
>  - simplified conditions that used >= when > was impossible
>  - reducing the number of field reads where convenient
> 
> This tidy up is intended to prepare BufferedReader for some further 
> bugfixing. We've seen some bugs reported against readLine() and I found it 
> quite frustrating to work on the code when the names were wrong (ie. count) 
> or of a foreign style (such as fillbuf()). I also attempted to document what 
> the heck was going on in the more sophiticated methods.
> 
> Modified:
>     
> harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/BufferedReader.java

Reply via email to