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

REGRESSION:JLabel with HTML text not showing in applet when applet restarted in IE8

    Details

    • Subcomponent:
    • CPU:
      x86
    • OS:
      windows_xp, windows_7

      Description

      FULL PRODUCT VERSION :
      java version "1.6.0_22"
      Java(TM) SE Runtime Environment (build 1.6.0_22-b04)
      Java HotSpot(TM) Client VM (build 17.1-b03, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [versie 6.1.7600]

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      IE version 8.0.7600.16385

      A DESCRIPTION OF THE PROBLEM :
      Applet with JLabel with html text, like new JLabel("<html>foobar")
      The first time the applet is run, the text shows ok.
      The second time the applet is run while the plugin is still loaded in the browser, the HTML text is not shown.
      This happens after a refresh of the page, but also when returning to the page after visiting another one.
      Clearing the class loader cache does not fix the problem.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      I have put a test applet online.
      Using IE8, surf to http://beta.rummigame.com/testapplet.html
      When the applet is showing, press F5

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The same output as before the reftesh: two lines like:
      A label with plain text
      A label with styled text
      ACTUAL -
      Only the plain text is shown; the label with html is not

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      Probably related: when doing setText("<html>...") in a JEditorPane with a HTMLEditorKit, I get when the applet is started for the second time:

      Error: java.lang.NullPointerException
          at javax.swing.text.html.parser.Parser.errorContext(Unknown Source)
          at javax.swing.text.html.parser.Parser.parse(Unknown Source)
          at javax.swing.text.html.parser.DocumentParser.parse(Unknown Source)
          at javax.swing.text.html.parser.ParserDelegator.parse(Unknown Source)
          at javax.swing.text.html.HTMLEditorKit.read(Unknown Source)
          at javax.swing.JEditorPane.setText(Unknown Source)

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      package test;

      import javax.swing.BoxLayout;
      import javax.swing.JApplet;
      import javax.swing.JLabel;
      import javax.swing.SwingUtilities;

      public class TestApplet extends JApplet
      {
          private void createGui()
          {
              setLayout(new BoxLayout(getContentPane(),BoxLayout.Y_AXIS));
              add(new JLabel("A label with plain text"));
              add(new JLabel("<html>A <u>label</u> with <i>styled</i> text"));
          }

          @Override
          public void init()
          {
              SwingUtilities.invokeLater(new Runnable()
              {
                  public void run()
                  {
                      createGui();
                  }
              });
          }

      }

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Close the browser or wait until the plugin is unloaded.

      The applet runs fine all the time in Firefox (but my users mostly use IE and experience the problem when they restart my game applet).

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                rupashka Pavel Porvatov (Inactive)
                Reporter:
                webbuggrp Webbug Group
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: