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

Oliver Kopp duke at openjdk.org
Sat Apr 20 15:57:35 UTC 2024


On Sat, 20 Apr 2024 15:36:44 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 with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 19 additional commits since the last revision:
> 
>  - Merge remote-tracking branch 'upstream/master' into patch-1
>  - Remove accidently commited file
>  - Fix method name
>  - Check for overflow
>  - Add method comment
>  - Fix visibility
>  - Convert test to JUnit5
>  - Introduce Shim
>  - Rename method, add comments, simplify method
>  - Fix visibility
>  - ... and 9 more: https://git.openjdk.org/jfx/compare/d79fe2b5...ab651984

There is use of native code in the `static` block


    private native static void _initIDs();
    static {
        _initIDs();
    }


Currently, all tests fail because that native library is not found

    java.lang.UnsatisfiedLinkError: 'void com.sun.glass.ui.win.WinTextRangeProvider._initIDs()'

I don't know how to load native libraries here. - I could also change that code part of WinTextRangeProvider to behave different in test mode. But that is a bad pattern, isn't it?

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

PR Comment: https://git.openjdk.org/jfx/pull/1442#issuecomment-2067714382


More information about the openjfx-dev mailing list