RFR: 8189354: ArrayIndexOutOfBoundsException when listening to selection changes on TreeTableView [v4]

Jeanette Winzenburg fastegal at openjdk.java.net
Wed Apr 28 10:52:54 UTC 2021


On Tue, 27 Apr 2021 16:20:27 GMT, mstr2 <github.com+43553916+mstr2 at openjdk.org> wrote:

> This JBS issue lists the following issues:
> 
>     1. The SelectedItems list does not get Remove change notifications in many cases
> 
>     2. IndexOutOfBoundsException is thrown while changing the selection in some cases
> 
>     3. If the collapse widget is toggled for the parent item of selected items, that parent item becomes selected. However, if none of the child items were selected, toggling the collapse/expand widget does not change the selection. But, if a parent of the the parent is also selected while child nodes are selected toggling the collapse widget doesn't select the item, and the parent item remains selected.
> 
> 
> Regarding 1:
> I think this is an artifact of the test program attached to the JBS issue; it is not a bug in JavaFX. The test program uses a `if {...} else if {...} else if {...} ...` branch to query the change, which is not a correct implementation and misses remove notifications that are part of replace notifications.
> 

good catch - I agree that's a usage error.

> Regarding 2:
> This PR fixes that.
> 

Hmm .. doesn't seem to be throwing since fx9 as of Ajit's first comment, in fact can't reproduce it with current fx16dev, neither with nor without this PR 

> Regarding 3:

didn't dig - but selecting the parent on collapsing it _and_ have the selectedIndex (== primary selection) in its child tree definitely is intentional (and standard behaviour in win). If there's a bug somehow, most probably not related to this. 

> So, to summarize: I think both JSB issues refer to the same bug; JDK-8189228 does not describe a larger problem.

There is one more issue mentioned (2nd comment by OP): toggling selection throws an NPE - that's still the case, both with and without this PR.

So my summary would be just the opposite: they are not related :)

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

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


More information about the openjfx-dev mailing list