RFR: 8176270: Adding ChangeListener to TextField.selectedTextProperty causes StringOutOfBoundsException

Jeanette Winzenburg fastegal at openjdk.java.net
Mon Jun 15 10:12:43 UTC 2020


On Mon, 15 Jun 2020 05:36:35 GMT, Robert Lichtenberger <rlichten at openjdk.org> wrote:

>> good direction, I think :)
>> 
>> Didn't look too closely, just added your changes and run the tests - getting a StringIndexOutofBounds at
>> TextInputControlTest.test_jdk_8171229_replaceText(TextInputControlTest.java:1862) (no failing test because the
>> uncaughtException handler not redirected). Could you check please?
>
>> good direction, I think :)
>> 
>> Didn't look too closely, just added your changes and run the tests - getting a StringIndexOutofBounds at
>> TextInputControlTest.test_jdk_8171229_replaceText(TextInputControlTest.java:1862) (no failing test because the
>> uncaughtException handler not redirected). Could you check please?
> 
> Will check this week.

seeing that you are working at it (and still without too close a look, sry ;) - we need more tests about the
notifications of all properties involved: text, selectedText, indexRange (anything else?).  The things to test are
count and old/new value. F.i. something like:

    List<String> values = new ArrayList();
    textField.selectedTextProperty().addListener((src, ov, nv) -> {
         list.addAll(ov, nv);
    }
    // do stuff
    assertEquals(2, values.size());
    assertEquals(expectedOldValue, values.get(0));
    assertEquals(expectedNewValue, values.get(1));

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

PR: https://git.openjdk.java.net/jfx/pull/138


More information about the openjfx-dev mailing list