8246282: [REDO] JDK-8245121 (bf) XBuffer.put(Xbuffer src) can give unexpected result when storage overlaps

Paul Sandoz paul.sandoz at oracle.com
Wed Jun 3 17:34:53 UTC 2020


+1

I did not know about Assert.expectThrows :-) Very useful.

Paul.

> On Jun 2, 2020, at 5:48 PM, Brian Burkhalter <brian.burkhalter at oracle.com> wrote:
> 
> An updated patch is [1] with the delta versus the previous version at [2].
> 
>> On Jun 2, 2020, at 10:37 AM, Paul Sandoz <paul.sandoz at oracle.com <mailto:paul.sandoz at oracle.com>> wrote:
>> 
>> IIRC for buffer equals/compare tests I had a separate test case. Given the fallback to the loop (and StringCharBuffer being read only) a minimal test seems appropriate.
> 
> I modified the existing test to define BufferKind.STRING and to expect the ReadOnlyBufferExceptions consequent to allowing a StringCharBuffer to be the destination of a put().
> 
>> On Jun 2, 2020, at 11:33 AM, Alan Bateman <Alan.Bateman at oracle.com <mailto:Alan.Bateman at oracle.com>> wrote:
>> 
>> This looks okay except using charRegionOrder to test the backing region is confusing. Maybe add a comment or else add a package private method to char production from X-buffer.java.template to test it.
> 
> I added a char-only package scope method isAddressable() which returns true by default with StringCharBuffer overriding it to return false.
> 
> Thanks,
> 
> Brian
> 
> [1] http://cr.openjdk.java.net/~bpb/8246282/webrev.02/ <http://cr.openjdk.java.net/~bpb/8246282/webrev.02/>
> [2] http://cr.openjdk.java.net/~bpb/8246282/webrev.01-02/ <http://cr.openjdk.java.net/~bpb/8246282/webrev.01-02/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/nio-dev/attachments/20200603/c216ce13/attachment.htm>


More information about the nio-dev mailing list