RFR: JDK-8311983: ListView sometimes throws an IndexOutOfBoundsException [v2]

Marius Hanl mhanl at openjdk.org
Thu Aug 3 15:13:09 UTC 2023


> An IOOBE was thrown when scrolling up via the trough (-> `VirtualScrollBar#adjustValue`).
> This happened only when it has bigger cells than the viewport. 
> If the the uppermost cell with the index 0 is only visible (although not completely scrolled to the top) and then an attempt is made to scroll up again, the `VirtualFlow` will try to scroll to the next cell, subtracting index 0 by 1, resulting in -1 -> IOOBE.
> 
> The code now guards against any under or overflow.
> 
> This is technically a regression from https://bugs.openjdk.org/browse/JDK-8173321
> 
> Note: While testing with very big cells, I found out that scrolling via the trough may not work after the first time. 
> This is because the `VirtualFlow` still creates 2 cells, although only one can be visible at a time (and `VirtualScrollBar` does this check, which will never be true then: `firstVisibleCell == lastVisibleCell`). This is unrelated to this fix. I can create a ticket when I have more information.

Marius Hanl has updated the pull request incrementally with three additional commits since the last revision:

 - JDK-8311983: remove JUnit5 import
 - JDK-8311983: improve exception handling
 - JDK-8311983: More tests

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

Changes:
  - all: https://git.openjdk.org/jfx/pull/1194/files
  - new: https://git.openjdk.org/jfx/pull/1194/files/63531d7f..0de3f7a6

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jfx&pr=1194&range=01
 - incr: https://webrevs.openjdk.org/?repo=jfx&pr=1194&range=00-01

  Stats: 49 lines in 2 files changed: 45 ins; 1 del; 3 mod
  Patch: https://git.openjdk.org/jfx/pull/1194.diff
  Fetch: git fetch https://git.openjdk.org/jfx.git pull/1194/head:pull/1194

PR: https://git.openjdk.org/jfx/pull/1194


More information about the openjfx-dev mailing list