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

HTMLEditorKit.read(Reader, Document, int) needs to handle replacing of text.

    XMLWordPrintable

    Details

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

      Description



      Name: aaC67449 Date: 05/18/98



      HTMLEditorKit.read(Reader, Document, int) hangs when trying to insert
      a text into the existing one.
      See example.
      This bug appears in jdk1.2beta4, all works correctly in jdk1.2beta3.

      ------------------Example-----------------------------------
      import java.awt.swing.text.html.*;
      import java.awt.swing.text.html.*;
      import java.awt.swing.text.*;
      import java.io.*;
      public class Test {

         public static void main(String argv[]) {
          String test1="<!DOCTYPE HTML PUBLIC \"-//w3c//DTD html 3.2//EN\"><HTML><HEAD><TITLE>test</TITLE></HEAD><BODY><P>add1</P></BODY></HTML>";
          String test2="<!DOCTYPE HTML PUBLIC \"-//w3c//DTD html 3.2//EN\"><HTML><HEAD><TITLE>test</TITLE></HEAD><BODY><P>add2</P></BODY></HTML>";
          HTMLEditorKit c= new HTMLEditorKit();
          Document doc = c.createDefaultDocument();
              
          try {
             c.read(new StringReader(test1),doc,0); // prepare test document
             System.out.println("Finished the first read");
             c.read(new StringReader(test2),doc,0); // write to it second time
             System.out.println("Passed");
          } catch(Exception e) {
              e.printStackTrace();
          }
         }

      }

      -------------------Output------------------------------------
      JAVA2D_USEPLATFORMFONT not set
      Disabling platform fonts
      Finished the first read
      ^C

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

        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: