RFR: 6257207: JTable.getDefaultEditor throws NullPointerException
Alexey Ivanov
aivanov at openjdk.org
Sat Oct 29 17:30:15 UTC 2022
On Wed, 26 Oct 2022 10:28:21 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> 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.
Changes requested by aivanov (Reviewer).
test/jdk/javax/swing/JTable/JTableBugTest.java line 41:
> 39: import javax.swing.SwingUtilities;
> 40:
> 41: public class JTableBugTest {
Can the test name be more specific?
test/jdk/javax/swing/JTable/JTableBugTest.java line 83:
> 81: resizeAll();
> 82: else
> 83: resize(column);
Could you please update the code to follow the Java Code Style Guidelines? I mean, the braces, the spaces after keywords and opening parenthesis and around binary operators…
-------------
PR: https://git.openjdk.org/jdk/pull/10871
More information about the client-libs-dev
mailing list