RFR: 6257207: JTable.getDefaultEditor throws NullPointerException
Prasanta Sadhukhan
psadhukhan at openjdk.org
Wed Oct 26 10:46:03 UTC 2022
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.
-------------
Commit messages:
- 6257207: JTable.getDefaultEditor throws NullPointerException
- 6257207: JTable.getDefaultEditor throws NullPointerException
- 6257207: JTable.getDefaultEditor throws NullPointerException
Changes: https://git.openjdk.org/jdk/pull/10871/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=10871&range=00
Issue: https://bugs.openjdk.org/browse/JDK-6257207
Stats: 134 lines in 2 files changed: 133 ins; 0 del; 1 mod
Patch: https://git.openjdk.org/jdk/pull/10871.diff
Fetch: git fetch https://git.openjdk.org/jdk pull/10871/head:pull/10871
PR: https://git.openjdk.org/jdk/pull/10871
More information about the client-libs-dev
mailing list