RFR: 8068824: Exception thrown in JTableHeader after clicking on popupmenu opened with right-click on header [v4]

Prasanta Sadhukhan psadhukhan at openjdk.org
Tue Apr 4 10:09:14 UTC 2023


> The issue is observed on mouse right click on the table header to open a pupup menu and then, do a mouse left click on the menu entry in which case we get AIOOBE
> This is because the columnIndex for popup menu is returned by `viewIndexForColumn `as -1 seen here https://github.com/openjdk/jdk/blob/941a7ac7dab243c6033a78880fd31faa803e62ab/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTableHeaderUI.java#L745-L753
> which is then passed to DefaultTableColumnModel.getColumn(columnIndex) causing it to throw AIOOBE as per the [DefaultTableColumnModel.getColumn spec](https://github.com/openjdk/jdk/blob/master/src/java.desktop/share/classes/javax/swing/table/DefaultTableColumnModel.java#L293)
> 
> So, inline with check done for `viewIndexForColumn `
> https://github.com/openjdk/jdk/blob/941a7ac7dab243c6033a78880fd31faa803e62ab/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTableHeaderUI.java#L310-L312
> a similar check is added when `viewIndexForColumn `is called

Prasanta Sadhukhan has updated the pull request incrementally with one additional commit since the last revision:

  test fix

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/13172/files
  - new: https://git.openjdk.org/jdk/pull/13172/files/130baf1a..0014c724

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=13172&range=03
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=13172&range=02-03

  Stats: 2 lines in 1 file changed: 0 ins; 0 del; 2 mod
  Patch: https://git.openjdk.org/jdk/pull/13172.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/13172/head:pull/13172

PR: https://git.openjdk.org/jdk/pull/13172



More information about the client-libs-dev mailing list