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-4696) [classlib][swing][html] JEditorPane doesn't recognize HTML by file name
Date Wed, 29 Aug 2007 14:51:31 GMT

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

Vasily Zakharov commented on HARMONY-4696:
------------------------------------------

Here's another reproducer:

import javax.swing.JEditorPane;
import javax.swing.text.EditorKit;
public class Test {
    public static void main(String argv[]) {
        try {
            JEditorPane editorPane = new JEditorPane();
            EditorKit editorKit = editorPane.getEditorKit();
            System.out.println("BEFORE:");
            System.out.println("EditorKit:" + editorKit);
            System.out.println("DefaultDocument: " + editorKit.createDefaultDocument());
            System.out.println("ContentType: " + editorKit.getContentType());
            System.out.println("ViewFactory: " + editorKit.getViewFactory());
            editorPane.setPage("file:test.html");
            editorKit = editorPane.getEditorKit();
            System.out.println("AFTER:");
            System.out.println("EditorKit:" + editorKit);
            System.out.println("DefaultDocument: " + editorKit.createDefaultDocument());
            System.out.println("ContentType: " + editorKit.getContentType());
            System.out.println("ViewFactory: " + editorKit.getViewFactory());
        } catch (Exception e) {
            e.printStackTrace(System.out);
        }
    }
} 

Output on RI:

BEFORE:
EditorKit:javax.swing.JEditorPane$PlainEditorKit@1198891
DefaultDocument: javax.swing.text.PlainDocument@1551d7f
ContentType: text/plain
ViewFactory: javax.swing.JEditorPane$PlainEditorKit@1198891
AFTER:
EditorKit:javax.swing.text.html.HTMLEditorKit@1712b3a
DefaultDocument: javax.swing.text.html.HTMLDocument@ba5c7a
ContentType: text/html
ViewFactory: javax.swing.text.html.HTMLEditorKit$HTMLFactory@10d593e

Output on Harmony:

BEFORE:
EditorKit:javax.swing.JEditorPane$PlainEditorKit@6b646b64
DefaultDocument: javax.swing.text.PlainDocument@59c659c6
ContentType: text/plain
ViewFactory: javax.swing.JEditorPane$PlainEditorKit@6b646b64
AFTER:
EditorKit:javax.swing.JEditorPane$PlainEditorKit@6b646b64
DefaultDocument: javax.swing.text.PlainDocument@78787878
ContentType: text/plain
ViewFactory: javax.swing.JEditorPane$PlainEditorKit@6b646b64


> [classlib][swing][html] JEditorPane doesn't recognize HTML by file name
> -----------------------------------------------------------------------
>
>                 Key: HARMONY-4696
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4696
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Vasily Zakharov
>            Priority: Minor
>         Attachments: Harmony.jpg, RI.jpg
>
>
> The following simple test demonstrates the problem:
> import javax.swing.JFrame;
> import javax.swing.JEditorPane;
> public class Test {
>     public static void main(String argv[]) {
>         try {
>             JFrame frame = new JFrame();
>             frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
>             frame.add(new JEditorPane("file:test.html"));
>             frame.setSize(150, 100);
>             frame.setVisible(true);
>         } catch (Exception e) {
>             e.printStackTrace(System.out);
>         }
>     }
> } 
> test.html:
> normal <i>italic
> test.html contains HTML code not clearly detectable as HTML. However, this code is contained
in file having .html extension, and it's enough for RI to use HTML renderer. Harmony doesn't
do it. The attached screenshots demonstrate the results on RI and Harmony.

-- 
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