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 Fri, 31 Aug 2007 14:38:30 GMT

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

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

URLConnection.getContentType() performed wrong (see HARMONY-4699), and relying upon it was
difficult.

Now when HARMONY-4699 is fixed, we can provide the proper behavior for JEditorPane.getStream().
The attached patch contains the following changes:

- Added correct content type determining through URLConnection.getContentType() in getStream()
and setContentType(). This way, checking file names and content is only done in one place.

- Just in case the content types table changes in future, added support for both text/rtf
and application/rtf (see HARMONY-4699).

- Removed contentType field, getContentType() method now returns editorKit.getContentType()
- this way, the content type in JEditorPane and EditorKit is always consistent, and content
type for RTF would always be "text/rtf" (as in RI), even if initial content type from URLConnection.getContentType()
was "application/rtf" (this feature would only be visible after RTFEditorKit is implemented,
but it's good anyway).

- Method getContentTypeByInputStream() is removed, as URLConnection.guessContentTypeFromStream()
does the same.

- Method getContentTypeByEditorKit() is removed, as EditorKit.getContentType() does the same
in simpler way.


> [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-4696-Fix.patch, 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