RFR: 5041655: (ch) FileLock: negative param and overflow issues
Brian Burkhalter
bpb at openjdk.java.net
Fri Jan 28 17:24:18 UTC 2022
On Thu, 27 Jan 2022 22:12:32 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.
1. I thought through several possibilities, including `size < 0` implies `false` and using `Math.addExact()` with `position` and `size`. If `Math.addExact(position, size)` throws then the exception would be ignored.
2. I don't understand what you intend here. Was it instead maybe `overlaps(position, size)` for `position < 0` becomes `overlaps(0, size)`?
-------------
PR: https://git.openjdk.java.net/jdk/pull/7254
More information about the nio-dev
mailing list