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

EmptyStackException from DefaultStyledDocument$ElementBuffer.insertElement()

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.3.0
    • client-libs



      Name: skT45625 Date: 05/15/2000


      C:\>java -version
      java version "1.3.0"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
      Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)

      Attempt to display URL http://www.snapon.com via JEditorPane.setPage(URL)
      results in many EmptyStackExceptions (see trace below).

      ===============================================
      SOURCE CODE to demonstrate problem:

      public class TestHTMLRead extends javax.swing.JFrame
          implements java.awt.event.ActionListener
      {
      // Using JDK1.3 RC3, attempting to display www.snapon.com in a JEditorPane
      // results in an EmptyStackException. To see the bug, run this program
      // from a command window and load the browser by selecting the "Reload"
      // button at the bottom of the window.

          String url = "http://www.snapon.com";
          javax.swing.JEditorPane editorPane;
          javax.swing.JScrollPane scrollPane;
          javax.swing.JButton reloadButton;

          public TestHTMLRead()
          {
                  editorPane = new javax.swing.JEditorPane();
                  scrollPane = new javax.swing.JScrollPane(editorPane);
                  getContentPane().add(java.awt.BorderLayout.CENTER, scrollPane);

                  reloadButton = new javax.swing.JButton("Reload");
                  reloadButton.addActionListener(this);
                  getContentPane().add(java.awt.BorderLayout.SOUTH, reloadButton);
                  setSize(750, 425);
          }

          public void reloadBrowser()
          {
              try {
                  editorPane.setPage(url);
              } catch (java.io.IOException ex) { ex.printStackTrace(); }
          }

          public void actionPerformed(java.awt.event.ActionEvent event)
          {
              Object source = event.getSource();
              if (source == reloadButton)
              {
                  reloadBrowser();
              }
          }

          public static void main(String[] argv)
          {
              (new TestHTMLRead()).show();
          }
      }

      ======================================================
      trace:
      java.util.EmptyStackException
              at java.util.Stack.peek(Stack.java:82)
              at
      javax.swing.text.DefaultStyledDocument$ElementBuffer.insertElement(DefaultStyled
      Document.java:1620)
              at
      javax.swing.text.DefaultStyledDocument$ElementBuffer.create(DefaultStyledDocumen
      t.java:1280)
              at
      javax.swing.text.DefaultStyledDocument.create(DefaultStyledDocument.java:131)
              at javax.swing.text.html.HTMLDocument.create(HTMLDocument.java:244)
              at
      javax.swing.text.html.HTMLDocument$HTMLReader.flushBuffer(HTMLDocument.java:3012
      )
              at
      javax.swing.text.html.HTMLDocument$HTMLReader.flush(HTMLDocument.java:1921)
              at javax.swing.text.html.HTMLEditorKit.read(HTMLEditorKit.java:240)
              at javax.swing.JEditorPane.read(JEditorPane.java:421)
              at javax.swing.JEditorPane$PageLoader.run(JEditorPane.java:468)

      (Review ID: 104905)
      ======================================================================

            svioletsunw Scott Violet (Inactive)
            skondamasunw Suresh Kondamareddy (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: