On Thu, 3 Nov 2022 03:17:34 GMT, Prasanta Sadhukhan <[email protected]>
wrote:
>> If getDefaultEditor() is called before the JTable model is setup, it results
>> in NPE.
>>
>> This is because when JTable sets its model, which ends up firing a table
>> changed event. The testcase is listening for tableChanged events and
>> querying the editor. But the editor isn't installed until after the model is
>> set which results in NPE.
>> Fix is to ensure initializeLocalVars() which initializes default editor is
>> setup before JTable sets its model.
>>
>> No regression is observed in jtreg/jck testsuite with this change.
>
> Prasanta Sadhukhan has updated the pull request incrementally with one
> additional commit since the last revision:
>
> Test review fix
src/java.desktop/share/classes/javax/swing/JTable.java line 706:
> 704: setModel(dm);
> 705:
> 706: initializeLocalVars();
Did we check that the NPE now can be occurred in the initializeLocalVars since
the model at that point is null? For example the
initializeLocalVars->setTableHeader->firePropertyChange("tableHeader"....)->in
the listener the model will be null, while it was non null before the fix.
-------------
PR: https://git.openjdk.org/jdk/pull/10871