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

swing html parser assumes commented scripts in script tags

XMLWordPrintable

      FULL PRODUCT VERSION :
      java version "1.7.0-ea"
      Java(TM) SE Runtime Environment (build 1.7.0-ea-b22)
      Java HotSpot(TM) 64-Bit Server VM (build 11.0-b08, mixed mode)


      ADDITIONAL OS VERSION INFORMATION :
      Linux lithium 2.6.22-14-generic #1 SMP Sun Oct 14 21:45:15 GMT 2007 x86_64 GNU/Linux

      A DESCRIPTION OF THE PROBLEM :
      similar to bug 6631246, but this time a disagreement with the specification rather than a quality of implementation issue that can be swept under the carpet.

      http://www.w3.org/TR/html401/interact/scripts.html section 18.2.1:

      The SCRIPT element places a script within a document. This element may appear any number of times in the HEAD or BODY of an HTML document.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      run the program pasted below.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      i'd expect to see one line, the "real content!" line.
      ACTUAL -
      i see "fp>" in addition to the "real content!" line.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import javax.swing.*;
      public class test extends JFrame {
       private JTextPane textPane;
       public test() {
        setContentPane(textPane = new JTextPane());
        textPane.setContentType("text/html");
        textPane.setEditable(false);
        textPane.setText("<html><head></head><body><script type=\"text/javascript\">\nfunction whatever() { }\n</script><p>real content!</body></html>");
        pack();
        setVisible(true);
       }
       public static void main(String[] args) {
        new test();
       }
      }

      ---------- END SOURCE ----------

            malenkov Sergey Malenkov (Inactive)
            igor Igor Nekrestyanov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: