RFR: 8276806: Use Objects.checkFromIndexSize where possible in java.base
This is a follow-up for https://github.com/openjdk/jdk/pull/4507, looks like there are some cases that were not covered. Also this is related to https://github.com/openjdk/jdk/pull/3615 ------------- Commit messages: - 8276806: Use Objects.checkFromIndexSize where possible in java.base Changes: https://git.openjdk.java.net/jdk/pull/6297/files Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=6297&range=00 Issue: https://bugs.openjdk.java.net/browse/JDK-8276806 Stats: 55 lines in 11 files changed: 11 ins; 13 del; 31 mod Patch: https://git.openjdk.java.net/jdk/pull/6297.diff Fetch: git fetch https://git.openjdk.java.net/jdk pull/6297/head:pull/6297 PR: https://git.openjdk.java.net/jdk/pull/6297
On Mon, 8 Nov 2021 14:25:10 GMT, Сергей Цыпанов <duke@openjdk.java.net> wrote:
This is a follow-up for https://github.com/openjdk/jdk/pull/4507, looks like there are some cases that were not covered.
Also this is related to https://github.com/openjdk/jdk/pull/3615
src/java.base/share/classes/java/io/ObjectInputStream.java line 1199:
1197: public void readFully(byte[] buf, int off, int len) throws IOException { 1198: int endoff = off + len; 1199: Objects.checkFromToIndex(off, endoff, buf.length);
Why not using `Objects.checkFromIndexSize(off, len, buf.length);` just like in the previous change at line 1029 above? ------------- PR: https://git.openjdk.java.net/jdk/pull/6297
On Mon, 8 Nov 2021 14:52:59 GMT, Daniel Fuchs <dfuchs@openjdk.org> wrote:
Сергей Цыпанов has updated the pull request incrementally with one additional commit since the last revision:
8276806: Use Objects.checkFromIndexSize where possible in java.base
src/java.base/share/classes/java/io/ObjectInputStream.java line 1199:
1197: public void readFully(byte[] buf, int off, int len) throws IOException { 1198: int endoff = off + len; 1199: Objects.checkFromToIndex(off, endoff, buf.length);
Why not using `Objects.checkFromIndexSize(off, len, buf.length);` just like in the previous change at line 1029 above?
Good point, done! ------------- PR: https://git.openjdk.java.net/jdk/pull/6297
This is a follow-up for https://github.com/openjdk/jdk/pull/4507, looks like there are some cases that were not covered.
Also this is related to https://github.com/openjdk/jdk/pull/3615
Сергей Цыпанов has updated the pull request incrementally with one additional commit since the last revision: 8276806: Use Objects.checkFromIndexSize where possible in java.base ------------- Changes: - all: https://git.openjdk.java.net/jdk/pull/6297/files - new: https://git.openjdk.java.net/jdk/pull/6297/files/cd295a93..0089a644 Webrevs: - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=6297&range=01 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=6297&range=00-01 Stats: 2 lines in 1 file changed: 0 ins; 1 del; 1 mod Patch: https://git.openjdk.java.net/jdk/pull/6297.diff Fetch: git fetch https://git.openjdk.java.net/jdk pull/6297/head:pull/6297 PR: https://git.openjdk.java.net/jdk/pull/6297
On Mon, 8 Nov 2021 18:59:06 GMT, Сергей Цыпанов <duke@openjdk.java.net> wrote:
This is a follow-up for https://github.com/openjdk/jdk/pull/4507, looks like there are some cases that were not covered.
Also this is related to https://github.com/openjdk/jdk/pull/3615
Сергей Цыпанов has updated the pull request incrementally with one additional commit since the last revision:
8276806: Use Objects.checkFromIndexSize where possible in java.base
Marked as reviewed by rriggs (Reviewer). ------------- PR: https://git.openjdk.java.net/jdk/pull/6297
On Mon, 8 Nov 2021 18:59:06 GMT, Сергей Цыпанов <duke@openjdk.java.net> wrote:
This is a follow-up for https://github.com/openjdk/jdk/pull/4507, looks like there are some cases that were not covered.
Also this is related to https://github.com/openjdk/jdk/pull/3615
Сергей Цыпанов has updated the pull request incrementally with one additional commit since the last revision:
8276806: Use Objects.checkFromIndexSize where possible in java.base
This Looks OK to me ------------- Marked as reviewed by lancea (Reviewer). PR: https://git.openjdk.java.net/jdk/pull/6297
On Mon, 8 Nov 2021 14:25:10 GMT, Сергей Цыпанов <duke@openjdk.java.net> wrote:
This is a follow-up for https://github.com/openjdk/jdk/pull/4507, looks like there are some cases that were not covered.
Also this is related to https://github.com/openjdk/jdk/pull/3615
This pull request has now been integrated. Changeset: 73a9654c Author: Sergey Tsypanov <sergei.tsypanov@yandex.ru> Committer: Roger Riggs <rriggs@openjdk.org> URL: https://git.openjdk.java.net/jdk/commit/73a9654c2685e14454a355a16bfe3f668796... Stats: 54 lines in 11 files changed: 11 ins; 14 del; 29 mod 8276806: Use Objects.checkFromIndexSize where possible in java.base Reviewed-by: rriggs, lancea ------------- PR: https://git.openjdk.java.net/jdk/pull/6297
participants (4)
-
Daniel Fuchs
-
Lance Andersen
-
Roger Riggs
-
Сергей Цыпанов