JDK-4194562 : JEditorPane in JApplet throws a java.lang.Error
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.2.0
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic,solaris_2.5.1
  • CPU: generic,sparc
  • Submitted: 1998-12-03
  • Updated: 1999-03-04
  • Resolved: 1999-03-04
Related Reports
Duplicate :  
Description

Name: diC59631			Date: 12/03/98


1.JEditorPane in JApplet throws java.lang.Error
when read a html including table and tr tag.
2.
------ Test.java ------ Test.java ------
import javax.swing.*;
public class Test extends JApplet {
    JEditorPane editor = new JEditorPane();

    public void init() {
        getContentPane().add(new JScrollPane(editor));
    }

    public void start() {
        try {
            editor.setPage(new java.net.URL(getDocumentBase(), "sample.html"));
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
------ test.html ------ test.html ------
<html>
<head></head>
<body>
<applet code="Test" width=320 height=480>
</applet>
</body>
</html>
------ sample.html ------ sample.html ------
<html>
<head></head>
<body>
<table>
<tr><td>sample</td></tr>
</table>
</body>
</html>
------ $HOME/.java.policy ----- $HOME/.java.policy ------
grant {
    permission java.net.SocketPermission "web.server.name", "resolve";
    permission java.net.SocketPermission "web.server.ip.address:80", "connect,resolve";
};
3.
java.lang.Error: Can't build a tr, BranchElement(tr) 4,5

        at javax.swing.text.html.HTMLEditorKit$HTMLFactory.create(HTMLEditorKit.java:705)
        at javax.swing.text.CompositeView.loadChildren(CompositeView.java:61)
        at javax.swing.text.CompositeView.setParent(CompositeView.java:153)
        at javax.swing.text.CompositeView.replace(CompositeView.java:132)
        at javax.swing.text.BoxView.replace(BoxView.java:68)
        at javax.swing.text.BoxView.insertUpdate(BoxView.java:341)
        at javax.swing.plaf.basic.BasicTextUI$RootView.insertUpdate(BasicTextUI.java:1152)
        at javax.swing.plaf.basic.BasicTextUI$UpdateHandler.insertUpdate(BasicTextUI.java:1368)
        at javax.swing.text.AbstractDocument.fireInsertUpdate(AbstractDocument.java:160)
        at javax.swing.text.DefaultStyledDocument.create(DefaultStyledDocument.java:140)
        at javax.swing.text.html.HTMLDocument.create(HTMLDocument.java:223)
        at javax.swing.text.html.HTMLDocument$HTMLReader.flushBuffer(HTMLDocument.java:1687)
        at javax.swing.text.html.HTMLDocument$HTMLReader.flush(HTMLDocument.java:981)
        at javax.swing.text.html.HTMLEditorKit.read(HTMLEditorKit.java:234)
        at javax.swing.JEditorPane.read(JEditorPane.java:381)
        at javax.swing.JEditorPane$PageLoader.run(JEditorPane.java:427)
(Review ID: 43581)
======================================================================