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

Alexey Ivanov aivanov at openjdk.java.net
Wed May 25 13:19:56 UTC 2022


On Wed, 25 May 2022 13:06:50 GMT, Andrey Turbanov <aturbanov 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.
>
> src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsTableHeaderUI.java line 92:
> 
>> 90:             this.hasFocus = hasFocus;
>> 91:             this.column = column;
>> 92:             if(table != null)
> 
> let's add space after `if`

And put the opening brace on the same line as `if` itself to follow the Java coding style and the style that's used in below.

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

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



More information about the client-libs-dev mailing list