<i18n dev> RFR: 8302664: Fix several incorrect usages of Preconditions.checkFromIndexSize

Alan Bateman alanb at openjdk.org
Fri Feb 17 13:38:27 UTC 2023

On Thu, 16 Feb 2023 14:42:52 GMT, Jaikiran Pai <jpai at openjdk.org> wrote:

> Can I please get a review of this change which fixes the usage of `Preconditions.checkFromIndexSize`? This addresses https://bugs.openjdk.org/browse/JDK-8302664.
> There was an oversight when these changes were introduced in https://github.com/openjdk/jdk/pull/4507. I have now gone through that patch again to make sure the relevant places where this fix is needed has been addressed in this current PR.
> I have also looked into other changes in that PR, just to be sure that there aren't any similar fixes needed for other method calls that were introduced in it - they all look fine.
> tier1,tier2 and tier3 testing with this change passed successfully. I thought (and experimented a bit) to add new tests for Deflater/Inflater to catch these byte array indexing issues, but it wasn't straight forward and I would have to write the entire inflate/deflate test just to verify this issue. So I decided to leave out new tests for now in this PR.

It's easy to get the parameters wrong to these methods but if the fromIndex and size are mixed up then it should just impact the exception message.


Marked as reviewed by alanb (Reviewer).

PR: https://git.openjdk.org/jdk/pull/12595

More information about the i18n-dev mailing list