RFR: 8332431: NullPointerException in JTable of SwingSet2 [v2]

Prasanta Sadhukhan psadhukhan at openjdk.org
Tue May 28 02:59:24 UTC 2024


> Issue is observed in JTable demo in SwingSet2 whereby if we set the focus on a table cell (or click on a table cell) and Press Ctrl+F1 (show/hide tooltip) on a cell of JTable then NullpointerException is seen
> 
>> Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException: Cannot invoke "java.awt.event.MouseEvent.getLocationOnScreen()" because "this.mouseEvent" is null 
> 
> This is because ToolTip associated with JTable demo button at top of SwingSet2 has MouseMotion Listener which causes [mouseEvent to be null](https://github.com/openjdk/jdk/blame/da3001daf79bf943d6194d9fd60250d519b9680d/src/java.desktop/share/classes/javax/swing/ToolTipManager.java#L573) when mouse exits the demo button area and enter the table cells area where show/hide tooltip causes showTipWindow to be called trying to access `mouseEvent` which is null.
> Fix is made to check for null in this kind of cases..No regression test is added as it can be checked easily with SwingSet2..

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

  Additional null check

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/19379/files
  - new: https://git.openjdk.org/jdk/pull/19379/files/00ac8e47..2e9c2337

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

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

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


More information about the client-libs-dev mailing list