[foreign-jextract] RFR: Improve NIO channel support for buffer views over segments

Chris Hegarty chegar at openjdk.java.net
Wed Apr 21 15:37:27 UTC 2021


On Wed, 21 Apr 2021 15:18:28 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> src/java.base/share/classes/java/nio/Buffer.java line 835:
>> 
>>> 833:                     try {
>>> 834:                         targetScope.checkValidState();
>>> 835:                     } catch (ScopedMemoryAccess.Scope.ScopedAccessError e) {   // ####: recheck thrown exs
>> 
>> Surprised to see this - your code should not be doing this - e.g. a failure in acquire() should trigger an ISE. Is the problem that you got the low level singleton exception (in which case that seems a bug in acquire()).
>
> I double checked - we throw right exception when needed. I think you should just drop the manual call to `checkValidState` and leave that to `acquire`.

Good catch - removed the explicit check

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

PR: https://git.openjdk.java.net/panama-foreign/pull/512


More information about the panama-dev mailing list