RFR: 6429812: NPE after calling JTable.updateUI() when using a header renderer + XP L&F [v8]

Alexey Ivanov aivanov at openjdk.java.net
Tue Jun 7 12:48:08 UTC 2022


On Tue, 7 Jun 2022 11:58:01 GMT, Tejesh R <tr at openjdk.org> wrote:

>> _Header_ object not initialized/set when paint() method of `WindowTableHeaderUI` class is executed. The paint() event is executed through explicit call of `JTable.updateUI()` in the regression test. In order to set the _header_ to the _called_ JTable, it is set in the `getTableCellRendererComponent()` method, which in turn makes the _header_ object available during paint event without causing NPE.
>
> Tejesh R has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Updated based on review comments and File name changed

It looks good now.

What's left is to ensure it passes when run headless. It should just work on Windows.

Can we address @mrserb's concern and extend the test be run on other platforms and with all L&Fs?

test/jdk/javax/swing/JTableHeader/TableHeaderRendererTest.java line 40:

> 38:  * @bug 6429812
> 39:  * @requires (os.family == "windows")
> 40:  * @summary Test to check if table is printed without NPE

Suggestion:

 * @summary Test to check if table header is painted without NPE

Nothing is printed in this test case.

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

PR: https://git.openjdk.java.net/jdk/pull/8830



More information about the client-libs-dev mailing list