RFR: 8266320: (bf) ReadOnlyBufferException in heap buffer put(String, int, int) should not be conditional

Alan Bateman alanb at openjdk.java.net
Fri Apr 30 15:28:52 UTC 2021


On Fri, 30 Apr 2021 07:20:44 GMT, Philippe Marschall <github.com+471021+marschall at openjdk.org> wrote:

> 8266320: (bf) ReadOnlyBufferException in heap buffer put(String,int,int) should not be conditional

src/java.base/share/classes/java/nio/Heap-X-Buffer.java.template line 289:

> 287: #else[rw]
> 288:         throw new ReadOnlyBufferException();
> 289: #end[rw]

I assume this isn't technically a bug in that it's unspecified which exception is thrown when the buffer is read-only and an index is out of range. The change is okay of course. It would be useful to run the tests without the addition to Basic-X.java.template as I would expect this case to be covered by an existing test already.

-------------

PR: https://git.openjdk.java.net/jdk/pull/3809


More information about the nio-dev mailing list