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

HTML Parser incorrectly parses attributes

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P3 P3
    • None
    • 1.3.0
    • client-libs



      Name: yyT116575 Date: 03/09/2001


      java version "1.3.0_01"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0_01)
      Java HotSpot(TM) Client VM (build 1.3.0_01, mixed mode)

      javax.swing.text.html.parser.Parser has a private method parseEntityReference(),
      which convertes HTML enitities to charaters. For example &gt is converted to >.
      However, this method is also called from Parser.parseAttributeValue(), so the
      conversion is done even when these strings appears as part of quoted attributes.
      This behavior is causing us trouble when the attribute is a URL.

      For example, assume the following is in the HTML file:
         <a href="info.html?page=3&sect=2">Info on Java Programming Language</a>

      The parser returns "greg.html?page=3?=2" for the value of the "href" attribute.
      That is, it has incorrectly interpreted the &sect parameter to the URL as an
      HTML string for the section character, and therefore mangled the URL into a
      meaningless string. I believe that these entity reference conversions should
      never be done when parsing parsing paramter values. The fix for this would be
      simple: remove the parseEntityReference() call from parseAttributeValue() in Parser.
      (Review ID: 118513)
      ======================================================================

            svioletsunw Scott Violet (Inactive)
            yyoungsunw Yung-ching Young (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: