RFR: 6539707: (fc) MappedByteBuffer.force() method throws an IOException in a very simple test [v2]
Brian Burkhalter
bpb at openjdk.java.net
Wed Feb 24 16:47:43 UTC 2021
On Wed, 24 Feb 2021 08:26:40 GMT, Alan Bateman <alanb at openjdk.org> wrote:
>> Brian Burkhalter has updated the pull request incrementally with two additional commits since the last revision:
>>
>> - 6539707: Fix whitespace error
>> - 6539707: Spec force() method of MappedByteBuffer and MappedMemorySegments to throw UncheckedIOException
>
> src/java.base/share/classes/java/nio/MappedByteBuffer.java line 230:
>
>> 228: * @return This buffer
>> 229: */
>> 230: public final MappedByteBuffer force() {
>
> The 2-arg force method will need to be updated too.
> Given that the methods are specified to write the buffer content back to the underlying storage device then I think it should be okay to say "If an I/O occurs writing the ...".
Will change.
> src/java.base/share/classes/java/nio/MappedMemoryUtils.java line 100:
>
>> 98: long offset = mappingOffset(address, index);
>> 99: try {
>> 100: force0(fd, mappingAddress(address, offset, index),
>
> Are you going to change force0 to declare that it throws IOException? I assumed you'd need to do that to get this code to compile.
It compiled without that change. In general I try to at least compile if not completely test before creating a PR. It should be changed however.
-------------
PR: https://git.openjdk.java.net/jdk/pull/2636
More information about the nio-dev
mailing list