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

HTMLEditorKit.read(...) method throws unexpected NullPointerException.

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      1.2beta4
    • CPU:
      sparc
    • OS:
      solaris_2.5.1, solaris_2.6
    • Verification:
      Verified

      Description



      Name: aaC67449 Date: 04/17/98



      The HTMLEditorKit.read(...) method throws unexpected NullPointerException when tries to read html text with <var> tag.

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

         public static void main(String argv[]) {
             String test="<!DOCTYPE HTML PUBLIC \"-//w3c//DTD html 3.2//EN\"><HTML><TITLE>test</TITLE><BODY><p><var>Test</var></p></BODY></HTML>";
             HTMLEditorKit c= new HTMLEditorKit();
              Document doc=c.createDefaultDocument();
              try {
                 c.read(new java.io.StringReader(test),doc,0);
                 System.out.println ("Passed");
              } catch(Exception e) {
                  e.printStackTrace();
              }
        
         }

      }
      -------------------Output------------------------------------
      java.lang.NullPointerException
              at java.awt.swing.text.html.HTMLDocument$HTMLReader.getChildStyle(HTMLDocument.java:252)
              at java.awt.swing.text.html.HTMLDocument$HTMLReader.varOpenAction(HTMLDocument.java:746)
              at java.awt.swing.text.html.html32._var(html32.java:1196)
              at java.awt.swing.text.html.html32.Ephrase(html32.java:270)
              at java.awt.swing.text.html.html32.Etext(html32.java:379)
              at java.awt.swing.text.html.html32.p(html32.java:2182)
              at java.awt.swing.text.html.html32.Eblock(html32.java:1387)
              at java.awt.swing.text.html.html32.Ebody_content(html32.java:1488)
              at java.awt.swing.text.html.html32.body(html32.java:1604)
              at java.awt.swing.text.html.html32.html(html32.java:3766)
              at java.awt.swing.text.html.HTMLDocument$HTMLReader.read(HTMLDocument.java:229)
              at java.awt.swing.text.html.HTMLDocument.read(HTMLDocument.java:140)
              at java.awt.swing.text.html.HTMLEditorKit.read(HTMLEditorKit.java:112)
              at Test.main(Test.java:10)
      java.io.IOException: java.lang.NullPointerException
              at java.awt.swing.text.html.HTMLDocument$HTMLReader.read(HTMLDocument.java:232)
              at java.awt.swing.text.html.HTMLDocument.read(HTMLDocument.java:140)
              at java.awt.swing.text.html.HTMLEditorKit.read(HTMLEditorKit.java:112)
              at Test.main(Test.java:10)


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

        Attachments

          Activity

            People

            Assignee:
            smanisunw Sunita Mani (Inactive)
            Reporter:
            aalievsunw Artem Aliev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: