[jdk16] RFR: 8259027: NullPointerException in makeMappedSegment due to NULL Unmapper when length of segment is 0 [v2]

Uwe Schindler uschindler at openjdk.java.net
Tue Jan 5 15:53:56 UTC 2021


On Tue, 5 Jan 2021 15:42:11 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> When the size of the memory map is zero, FileChannelImpl returns a `null` Unmapper - this creates issues to the mapped memory segment implementation.
>> 
>> To fix, I've created an empty mapped segment class which is initialized to sensible defaults, and whose implenentation of force/load etc. do nothing.
>> 
>> We already had a test for this condition - but the test was missing the `@Test` annotation, so it was not run! I've now beefed up the test a bit to make sure that mapped segment operations do not throw.
>
> Maurizio Cimadamore has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Added empty mapping support for different access modes

Looks fine!
In fact it's more complicated than the workaround, but this allows to call load() or force().

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

Marked as reviewed by uschindler (Author).

PR: https://git.openjdk.java.net/jdk16/pull/83


More information about the core-libs-dev mailing list