harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vasily Zakharov (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HARMONY-4755) [classlib][swing][html] JEditorPane.setPage() throws NPE
Date Tue, 11 Sep 2007 11:06:32 GMT

    [ https://issues.apache.org/jira/browse/HARMONY-4755?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12526420
] 

Vasily Zakharov commented on HARMONY-4755:
------------------------------------------

Alexey, thank you for your interest to this issue. Here're some more detail:

We have two threads that are conflicting. First thread (main) creates a new BlockView and
initializes it. The second thread (EventDispatchThread) tries to paint that view before it's
fully initialized. This is the conflict I'm talking about and it's described in detail, with
stacks and line numbers, above. Both threads use readLock() - the first thread locks at BasicTextUI.paintSafely(),
and the second thread locks in BasicTextUI.modelChanged() - I tested, needLock is always true
in my tests. These read locks do not prevent the conflict, as readLock() is not exclusive.
And I don't see how this can be fixed properly.

As of "readUnlock() on a document without locking it before" - this is a completely different
issue, unrelated to this one, it's now filed as HARMONY-4762. I can reproduce one issue without
another, and vice versa. So please ignore that issue while dealing with this one, they're
completely unrelated, though similar.

Thank you!


> [classlib][swing][html] JEditorPane.setPage() throws NPE
> --------------------------------------------------------
>
>                 Key: HARMONY-4755
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4755
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Vasily Zakharov
>            Assignee: Alexey A. Ivanov
>            Priority: Minor
>         Attachments: Harmony-4755-Fix.patch
>
>
> If JEditorPane.setPage() is called on a visible pane and passed an HTML URL, NPE occurs.
> Here's the simple reproducer:
> import javax.swing.JEditorPane;
> import javax.swing.JFrame;
> public class Test {
>     public static void main(String argv[]) {
>         try {
>             JFrame frame = new JFrame("Test");
>             frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
>             frame.setSize(100, 100);
>             JEditorPane pane = new JEditorPane();
>             frame.add(pane);
>             frame.setVisible(true);
>             pane.setPage("file:test.html");
>         } catch (Throwable e) {
>             e.printStackTrace(System.out);
>         }
>     }
> } 
> test.html should exist in current directory and may be empty.
> This test produces the following exception on Harmony:
> java.lang.NullPointerException
>         at javax.swing.text.html.BlockView.paint(BlockView.java:77)
>         at javax.swing.text.RootView.paint(RootView.java:211)
>         at javax.swing.plaf.basic.BasicTextUI.paintSafely(BasicTextUI.java:839)
>         at javax.swing.plaf.basic.BasicTextUI.paint(BasicTextUI.java:88)
>         at javax.swing.plaf.ComponentUI.update(ComponentUI.java:38)
>         at javax.swing.plaf.basic.BasicTextUI.update(BasicTextUI.java:955)
>         at javax.swing.JComponent.paintComponent(JComponent.java:897)
>         at javax.swing.JComponent.paint(JComponent.java:994)
>         at javax.swing.JComponent.paintDoubleBuffered(JComponent.java:1425)
>         at javax.swing.JComponent.paintImmediately(JComponent.java:156)
>         at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:186)
>         at javax.swing.RepaintManager$1.run(RepaintManager.java:80)
>         at java.awt.event.InvocationEvent.runAndNotify(InvocationEvent.java:98)
>         at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:78)
>         at java.awt.EventQueueCore.dispatchEventImpl(EventQueueCore.java:138)
>         at java.awt.EventQueue.dispatchEvent(EventQueue.java:144)
>         at java.awt.EventDispatchThread.runModalLoop(EventDispatchThread.java:74)
>         at java.awt.EventDispatchThread.run(EventDispatchThread.java:48)
> To see the exception, please enable stack trace printing at EventDispatchThread.java,
line 89.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message