Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4498752

html element "
" not recognized by JEditorKit

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: P4 P4
    • None
    • 1.3.1
    • client-libs



      Name: boT120536 Date: 08/31/2001


      java version "1.3.1"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1-b24)
      Java HotSpot(TM) Client VM (build 1.3.1-b24, mixed mode)


      Some sites (such as bugzilla.mozilla.org) use 
 instead of embedding actual
      newlines (\n) in a <pre> block. JEditorKit doesn't recognize this character
      reference, so as a result the whole block is displayed on a single line.

      The following example displays a page from bugzilla.mozilla.org, in which
      developers' comments end up being all in one line each.

      ---
      import javax.swing.*;
      import javax.swing.event.*;
      import java.awt.*;
      import java.net.URL;

      import java.beans.*;

      public class Foo extends JFrame {
          private JEditorPane browser;
          public Foo() {
              browser = new JEditorPane();
              browser.setEditable(false);
              JScrollPane scroller = new JScrollPane(browser);
              scroller.setPreferredSize(new Dimension(600, 400));
              getContentPane().add(scroller);
              pack();
              setVisible(true);
          }

          public void gotoHref(URL url) {
              try {
                  browser.setPage(url);
              } catch (Exception e) {}
          }

          public void gotoHref(String href) {
              try {
                  browser.setPage(href);
              } catch (Exception e) {}
          }

          static void main(String [] args) {
              new
      Foo().gotoHref("http://bugzilla.mozilla.org/show_bug.cgi?id=95762"); }
      }
      ---

      Open URL http://bugzilla.mozilla.org/show_bug.cgi?id=95762 in a regular browser
      to see what it should look like and have a look at the page source to notice
      &#013; characters that correspond to the missing line breaks in JEditorKit.
      (Review ID: 131085)
      ======================================================================

            peterz Peter Zhelezniakov
            bonealsunw Bret O'neal (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: