-
Bug
-
Resolution: Fixed
-
P4
-
1.2.0
-
1.2.2
-
sparc
-
solaris_2.5.1
Name: aaC67449 Date: 08/27/98
HTMLEditorKit.write(...) incorrectly writes FONT tags. When there are more then one FONT tags together, only one is written out.
See example. It reads html text with two FONT tags with various parameters and then writes the document to the standart output.
--------------------- Example ----------------
import com.sun.java.swing.text.html.*;
import com.sun.java.swing.text.*;
import java.io.*;
public class Test {
public static void main(String argv[]) {
String test="<!DOCTYPE HTML PUBLIC \"-//w3c//DTD html 3.2//EN\"><HTML><HEAD><TITLE>test</TITLE></HEAD><body><P><FONT size=+4>Test 1</FONT><FONT size=-3>Test 2</FONT></P></body></html>";
HTMLEditorKit c= new HTMLEditorKit();
Document doc=c.createDefaultDocument();
try {
c.read(new StringReader(test),doc,0);
StringWriter sw= new StringWriter();
c.write(sw,doc,0,30);
System.out.println(sw.toString());
} catch(Exception e) {
e.printStackTrace();
}
}
}
---------------- output ----------
<html>
<head>
<title>test </title>
</head>
<body>
<p>
<font size=+4>Test 1Test 2</font>
</p>
</body>
</html>
======================================================================