[9] RFR of 8143394: PushbackReader throws NullPointerException

Alan Bateman Alan.Bateman at oracle.com
Fri Dec 4 11:34:15 UTC 2015


On 04/12/2015 00:23, Brian Burkhalter wrote:
> Please review at your convenience.
>
> Issue:	https://bugs.openjdk.java.net/browse/JDK-8143394
> Patch:	http://cr.openjdk.java.net/~bpb/8143394/webrev.00/
>
> The NPE apparently occurred in PushbackReader because a call to close() was made after the conditional at line 72 was evaluated to ‘false’ but before the variable ‘buf’ was dereferenced at line 87. The fix is to change close() to use the ‘lock’ variable as in the other methods. Similar problems were found to exist in CharArrayReader and StringReader. The test reliably reproduces the NPE in all three classes with the NPE in PushbackReader being reproduced frequently and the NPE in the other classes less so.
>
I suspect this is going to need a spec update to make it clear that 
close will now block when there is another thread blocking on the reader.

-Alan



More information about the core-libs-dev mailing list