-
Bug
-
Resolution: Won't Fix
-
P3
-
None
-
1.2.2
-
sparc
-
solaris_2.5.1
Name: akC57697 Date: 01/21/99
This bug was found by St.Petersburg Java SQE team (by Sergey Scherbakov).
Method MinimalHTMLWriter.writeBody() writes out
incorrect structure of html.
The example:
-------------------------------------------------------------
import javax.swing.text.html.*;
import javax.swing.text.*;
import java.io.*;
public class Test {
public static void main(String argv[]) {
String test="<HTML><BODY>test</BODY></HTML>";
HTMLEditorKit c = new HTMLEditorKit();
HTMLDocument doc = new HTMLDocument();
try {
c.read(new StringReader(test),doc,0);
} catch (Exception e1) {
System.out.println("error");
}
StringWriter sw = new StringWriter();
StubMinimalHTMLWriter hw = new StubMinimalHTMLWriter(sw, doc);
System.out.println("--- The document is --");
doc.dump(System.out);
System.out.println("----------------------");
try {
hw.writeBody();
} catch (Exception e1) {
System.out.println("Unexpected "+e1);
}
System.out.println(sw.toString());
}
}
class StubMinimalHTMLWriter extends MinimalHTMLWriter {
StubMinimalHTMLWriter(Writer w, StyledDocument doc) {
super(w, doc);
}
public void writeBody() throws IOException, BadLocationException {
super.writeBody();
}
}
-------------------------------------------------------------
Output:
--- The document is --
<html
name=html
>
<p-implied
name=p-implied
>
<head
name=head
>
[0,1][ ]
<head
endtag=true
name=head
>
[1,2][ ]
<content
name=content
>
[2,3][
]
<body
name=body
>
<p-implied
name=p-implied
>
<content
name=content
>
[3,7][test]
<content
name=content
>
[7,8][
]
<p
name=p
>
<content
name=content
>
[8,9][
]
<bidi root>
<bidi level
bidiLevel=0
>
[0,9][
test
]
----------------------
<body> <-- The incorrect structure
<p>
</p>
<p>
<p>
test
</p>
</body>
======================================================================