Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4169405

HTMLEditorKit.write(...) incorrectly writes FONT tags

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      1.2.2
    • CPU:
      sparc
    • OS:
      solaris_2.5.1

      Description



      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>
       

      ======================================================================

        Attachments

          Activity

            People

            Assignee:
            svioletsunw Scott Violet (Inactive)
            Reporter:
            aalievsunw Artem Aliev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: