11 Replies Latest reply: Dec 13, 2010 2:43 PM by 807456 RSS

    1.6.0_22 HTMLEditorKit throws NullPointerException when reloaded

    806936
      Hi to all,

      I have an applet.
      I updated Java from 1.6.0_21 to 1.6.0_22.

      Then HTMLEditorKit throws NullPointerException when reloaded.
      I cann't use HTMLEditorKit in applet after reloaded.
      I want to know workaround.

      It works on 1.6.0_21.

      OS :Windows XP SP3 (Japanese)

      Thank you

      ---------------------------
      Applet source
      ---------------------------
      package sample;

      import javax.swing.JApplet;
      import javax.swing.JEditorPane;
      import javax.swing.text.html.parser.ParserDelegator;

      /**
      * <applet code="sample.SampleApplet.class" width="150" height="150"></applet>
      */
      public class SampleApplet extends JApplet {

      {
      System.out.println("initialize");
      }

      public void start() {
      System.out.println("start");
      String html = "<html><body>test</body></html>";
      JEditorPane.registerEditorKitForContentType("text/html", "javax.swing.text.html.HTMLEditorKit");

      try {
      JEditorPane htmlPane = new JEditorPane("text/html", html);
      } catch(RuntimeException e) {
      e.printStackTrace();
      }
      }
      }

      ---------------------------
      HTML for IE
      ---------------------------
      <html><body>
      <object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" width="150" height="150">
      <param name="code" value="sample.SampleApplet.class">
      </object>
      </body></html>



      ---------------------------
      result (applet viewer)
      ---------------------------
      java.lang.NullPointerException
      at javax.swing.text.html.parser.Parser.errorContext(Parser.java:736)
      at javax.swing.text.html.parser.Parser.parse(Parser.java:2240)
      at javax.swing.text.html.parser.DocumentParser.parse(DocumentParser.java:105)
      at javax.swing.text.html.parser.ParserDelegator.parse(ParserDelegator.java:78)
      at javax.swing.text.html.HTMLEditorKit.read(HTMLEditorKit.java:232)
      at javax.swing.JEditorPane.setText(JEditorPane.java:1499)
      at javax.swing.JEditorPane.<init>(JEditorPane.java:273)
      at sample.SampleApplet.start(SampleApplet.java:22)
      at sun.applet.AppletPanel.run(AppletPanel.java:464)
      at java.lang.Thread.run(Thread.java:662)