RFR: 5041655: (ch) FileLock: negative param and overflow issues [v5]

Alan Bateman alanb at openjdk.java.net
Wed Feb 9 14:21:17 UTC 2022


On Wed, 9 Feb 2022 02:57:46 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

>> Add an implementation note to `java.nio.channels.FileLock.overlaps(long,long)` indicating that the method does not check its parameters. Adding such checks would be an incompatible change.
>
> Brian Burkhalter has refreshed the contents of this pull request, and previous commits have been removed. The incremental views will show differences compared to the previous content of the PR. The pull request contains one new commit since the last revision:
> 
>   5041655: Move size zero handling to file channel impl classes

Thanks for the update, I think this change is on the right track now.

For FileChannel.lock we'll need to come up with wording that perceivably describes the behavior for the size==0 case. The issue with phrases like "remainder of the file" is that file may be extended after locking.

The update to the FileLock protected constructors will need attention too. Extending FileLock and calling the constructor with size==0 does align the proposed spec change. I think it will work if you drop "A value of zero indicates the remainder of the file" from the javadoc.

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

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


More information about the nio-dev mailing list