RFR: 8330462: StringIndexOutOfBoundException when typing anything into TextField [v25]

Ambarish Rapte arapte at openjdk.org
Thu May 2 10:06:02 UTC 2024


On Wed, 1 May 2024 04:46:29 GMT, Oliver Kopp <duke at openjdk.org> wrote:

>> Fixes https://bugs.openjdk.org/browse/JDK-8330462.
>> 
>> If the parameter `maxLength` is larger than `Integer.MAX_VALUE - start`, then an addition of `start` to it leads to a negative value. This is "fixed" by using `Math.max` comparing the `maxLength` and `maxLength + start`.
>
> Oliver Kopp has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Adress review comments

The fix looks good, I have few comments about the test.
1. The test does not compile without fix, hence it won't fail without fix as we are only testing the newly added helper method.
2. It is not required to change the error stream, as the test does/need not inspect the error output.
3. The test method and parameter source method names can be changed a little.
4. We should use the Util class for standard setup like initializing JavaFX/ shutting it down.


I tried above changes to test locally, attaching the file for ease.
[WinTextRangeProviderTest.zip](https://github.com/openjdk/jfx/files/15186626/WinTextRangeProviderTest.zip)

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

Changes requested by arapte (Reviewer).

PR Review: https://git.openjdk.org/jfx/pull/1442#pullrequestreview-2035329983


More information about the openjfx-dev mailing list