RFR: 8301763: Adding children to wrong index leaves inconsistent state in Parent#childrenSet [v2]

Lukasz Kostyra lkostyra at openjdk.org
Wed May 17 15:22:57 UTC 2023


> This issue happened because `childSet` member of Parent was modified during `onProposedChange()` call - that call did not recognize negative indexes as invalid, which caused an exception when actually adding the Node to a List.
> 
> This seemed like the simplest solution which doesn't rework a lot of code underneath. Exceptions coming from a backing list/collection technically are handled by `VetoableListDecorator`'s try-catch clauses, however `VetoableListDecorator` does not provide an interface to react when such an exception happens - without it we cannot revert `childSet` back to its original state.

Lukasz Kostyra has updated the pull request incrementally with three additional commits since the last revision:

 - Add index/null checks to ObservableListWrapper and VetoableListDecorator
 - ParentTest: Expect IndexOutOfBoundsException, add test cases
 - Parent: Remove index check from onProposedChange

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

Changes:
  - all: https://git.openjdk.org/jfx/pull/1136/files
  - new: https://git.openjdk.org/jfx/pull/1136/files/1508c62d..63023839

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

  Stats: 77 lines in 4 files changed: 63 ins; 11 del; 3 mod
  Patch: https://git.openjdk.org/jfx/pull/1136.diff
  Fetch: git fetch https://git.openjdk.org/jfx.git pull/1136/head:pull/1136

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


More information about the openjfx-dev mailing list