harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexey A. Ivanov (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HARMONY-3625) [classlib][swing] JTextPane throws java.lang.IllegalArgumentException: Model must be 'StyledDocument'
Date Tue, 24 Apr 2007 07:57:15 GMT

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

Alexey A. Ivanov commented on HARMONY-3625:

The following line is worth adding to the test case as well:
System.out.println("doc=" + pane.getDocument().getClass());

If you run the modified example application, you'll get the following output on RI:
doc=class javax.swing.text.DefaultStyledDocument

Harmony output before setPage() is called is the same:
doc=class javax.swing.text.DefaultStyledDocument

Whereas Harmony code tries to change the EditorKit of JTextPane to PlainEditorKit. And it
is the action that can't be done. (RI doesn't change it -- that's it.)

I guess BasicTextPaneUI should be modified and getEditorKit() method should be overridden
to always return StyledEditorKit descendant.

Additionally, if you change JTextPane to JEditorPane in this example, both editor kit and
document will refer to PlainEditorKit and PlainDocument accordingly.

> [classlib][swing] JTextPane throws java.lang.IllegalArgumentException: Model must be
> -----------------------------------------------------------------------------------------------------
>                 Key: HARMONY-3625
>                 URL: https://issues.apache.org/jira/browse/HARMONY-3625
>             Project: Harmony
>          Issue Type: Bug
>          Components: App-Oriented Bug Reports, Classlib
>            Reporter: Mikhail Fursov
> Here is the test:
> import javax.swing.*;
> public class Test {
>     public static void main(String[] arg) throws Exception {
>         JFrame frame = new JFrame("Hello");
>         frame.resize(640,480);
>         JTextPane pane = new JTextPane();
>         frame.add(pane);
>         java.net.URL url = Test.class.getResource("Test.java");
>         pane.setPage(url);
>         frame.setVisible(true);
>     }
> }
> It runs OK on SUN or BEA but fails on Harmony with 
> Uncaught exception in main:
> java.lang.IllegalArgumentException: Model must be 'StyledDocument'
>         at javax.swing.JTextPane.setDocument(JTextPane.java:72)
>         at javax.swing.JEditorPane.updateDocument(JEditorPane.java:610)
>         at javax.swing.JEditorPane.setContentType(JEditorPane.java:577)
>         at javax.swing.JEditorPane.getStream(JEditorPane.java:464)
>         at javax.swing.JEditorPane.setPage(JEditorPane.java:700)
>         at Test.main(Test.java:11)
> error.
> This problem is a blocker for JFreeChart demo when run on Harmony.

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

View raw message