RFR: 8328977 : JEditorPane.setPage not thread-safe, pageLoader not cancelled [v3]
Alexey Ivanov
aivanov at openjdk.org
Wed Feb 5 12:21:24 UTC 2025
On Fri, 19 Apr 2024 14:53:09 GMT, Renjith Kannath Pariyangad <rkannathpari at openjdk.org> wrote:
>> Hi Reviewers,
>>
>> Added pageloader cancel before new page creation along with code restructuring. Moved all page loading calls inside synchronize to make it thread safe.
>>
>> Regards,
>> Renjith.
>
> Renjith Kannath Pariyangad has updated the pull request incrementally with one additional commit since the last revision:
>
> Rearranged if based on suggesion
There are lots of failures with the message: _java.lang.NullPointerException: Cannot invoke "java.net.URL.getProtocol()" because "u2" is null_
For example, the `javax/swing/JEditorPane/4492274/bug4492274.java` test fails with the following stack traces:
----------System.err:(32/2233)----------
java.lang.reflect.InvocationTargetException
at java.desktop/java.awt.EventQueue.invokeAndWait(EventQueue.java:1312)
at java.desktop/java.awt.EventQueue.invokeAndWait(EventQueue.java:1287)
at java.desktop/javax.swing.SwingUtilities.invokeAndWait(SwingUtilities.java:1474)
at bug4492274.main(bug4492274.java:50)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
at java.base/java.lang.reflect.Method.invoke(Method.java:565)
at com.sun.javatest.regtest.agent.MainWrapper$MainTask.run(MainWrapper.java:138)
at java.base/java.lang.Thread.run(Thread.java:1447)
Caused by: java.lang.RuntimeException: java.lang.NullPointerException: Cannot invoke "java.net.URL.getProtocol()" because "u2" is null
at bug4492274.createAndShowGUI(bug4492274.java:113)
at bug4492274$1.run(bug4492274.java:53)
at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313)
at …
at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
Caused by: java.lang.NullPointerException: Cannot invoke "java.net.URL.getProtocol()" because "u2" is null
at java.base/java.net.URLStreamHandler.sameFile(URLStreamHandler.java:413)
at java.base/java.net.URL.sameFile(URL.java:1123)
at java.desktop/javax.swing.JEditorPane.setPage(JEditorPane.java:478)
at bug4492274.createAndShowGUI(bug4492274.java:104)
... 10 more
src/java.desktop/share/classes/javax/swing/JEditorPane.java line 480:
> 478: final String reference = page.getRef();
> 479:
> 480: if ((postData == null) && page.sameFile(loaded)) {
This line of code causes lots of test failures because `page.sameFile(loaded)` doesn't accept a `null` parameter, which results in `NullPointerException`.
-------------
Changes requested by aivanov (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/18670#pullrequestreview-2595528235
PR Review Comment: https://git.openjdk.org/jdk/pull/18670#discussion_r1942776674
More information about the client-libs-dev
mailing list