[9] RFR of 8143394: PushbackReader throws NullPointerException
Brian Burkhalter
brian.burkhalter at oracle.com
Tue Dec 8 00:11:26 UTC 2015
On Dec 4, 2015, at 3:34 AM, Alan Bateman <Alan.Bateman at oracle.com> wrote:
> 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.
Here is an updated version
http://cr.openjdk.java.net/~bpb/8143394/webrev.01/
wherein the sentence "This method will block if there is another thread blocking on the reader.” is added to the specification of close() in each of the affected classes. Not sure whether this change requires CCC approval.
Thanks,
Brian
More information about the core-libs-dev
mailing list