views:

29

answers:

1

The following test fails with JRE 1.6.0_20

public void testSetGetTextWithList() throws Exception {
    final JEditorPane editorPane = new JEditorPane();
    editorPane.setContentType("text/html");
    editorPane.setText("<ul><li></li></ul>");
    assertTrue(editorPane.getText().contains("<ul"));
}

Of course, there is a visual difference between an empty list and a non-existing list, so I expect the editor not to discard the empty list. Anybody with an easy solution for this problem?

+1  A: 

The error occurs only if the element is the last block element in the document, the test passes if you change the input to one of

<ul><li></li></ul>a
<ul><li></li></ul><p></p>
<ul><li></li></ul>&nbsp;
<ul><li></li></ul><!---->
ndn