RFR: 8282548: Create a regression test for JDK-4330998
Alexey Ivanov
aivanov at openjdk.java.net
Wed Mar 16 16:31:52 UTC 2022
On Tue, 8 Mar 2022 10:06:23 GMT, Manukumar V S <mvs at openjdk.org> wrote:
> Create a regression test for [JDK-4330998](https://bugs.openjdk.java.net/browse/JDK-4330998)
> Context: Migrating tests from a closed tonga based test suite to open regression based one.
>
> Issue tested:
> When calling JEditorPane.setText(null), the following exception is thrown:
>
> java.lang.NullPointerException:
> at java.io.StringReader.<init>(StringReader.java:38)
>
> Testing:
> Java 1.4.0 -> Test Failed.
> $ ./j2sdk1.4.0/bin/java bug4330998Win
> java.lang.RuntimeException: Test failed, caught Exception java.lang.NullPointerException when calling text.setText(null)
> at bug4330998Win.runTest(bug4330998Win.java:45)
> at bug4330998Win.main(bug4330998Win.java:51)
> Exception in thread "main"
>
> Java 1.4.1 -> Test Passed.
> $ ./j2sdk1.4.1/bin/java bug4330998Win
> Test passed
Changes requested by aivanov (Reviewer).
test/jdk/javax/swing/JEditorPane/4330998/JEditorPaneSetTextNullTest.java line 41:
> 39:
> 40: try {
> 41: SwingUtilities.invokeAndWait(() -> editorPane.setText(null));
I believe the test could be simplified to
Suggestion:
SwingUtilities.invokeAndWait(() -> new JEditorPane().setText(null));
And `createUI()` can be removed.
-------------
PR: https://git.openjdk.java.net/jdk/pull/7740
More information about the client-libs-dev
mailing list