RFR: 8296024: Usage of DIrectBuffer::address should be guarded [v13]

ExE Boss duke at openjdk.org
Fri Nov 25 06:49:27 UTC 2022


On Thu, 24 Nov 2022 14:56:07 GMT, Per Minborg <pminborg at openjdk.org> wrote:

>> src/java.base/share/classes/sun/nio/ch/IOUtil.java line 480:
>> 
>>> 478:     static MemorySessionImpl acquireScope(ByteBuffer bb, boolean async) {
>>> 479:         if (async && NIO_ACCESS.isThreadConfined(bb)) {
>>> 480:             throw new IllegalStateException("Confined session not supported");
>> 
>> No sure about ISE here. There is no mutable state on the input that would allow the acquire to succeed. I don't think anyone has run into it yet but we will need to look at the AsynchronousXXXX read/write methods to decide which exception to specify.
>
> This was the old behaviour which was retained in this PR.

I believe `UnsupportedOperationException` would be better for this.

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

PR: https://git.openjdk.org/jdk/pull/11260


More information about the nio-dev mailing list