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

javax.xml.XmlEventReader swallows whitespace after StartDocument event

XMLWordPrintable

    • b01
    • 16
    • generic
    • generic

      A DESCRIPTION OF THE PROBLEM :
      The default implementation of javax.xml.XmlEventReader consumes the newline frequently found after the StartDocument event of a document. That is to say, a Characters event does not get emitted after the StartDocument event, but does get emitted after other StartElement and EndElement events.

      The text:
      <?xml version=\"1.0\"?>
      <outer>

      gets reported as [StartDocument, StartElement] but should be [StartDocument, Characters, StartElement].

      This bug also exists in 11. I didn't test 8.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      You can see a Jtreg test that demonstrates the behavior here: https://github.com/openjdk/jdk/compare/master...MariusVolkhart:mv/xmlCharacters

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      You can see a Jtreg test that demonstrates the behavior here: https://github.com/openjdk/jdk/compare/master...MariusVolkhart:mv/xmlCharacters
      ACTUAL -
      The test fails on line 90. The event is actually a StartElement rather than a Characters

      ---------- BEGIN SOURCE ----------
      You can see a Jtreg test that demonstrates the behavior here: https://github.com/openjdk/jdk/compare/master...MariusVolkhart:mv/xmlCharacters
      ---------- END SOURCE ----------

      FREQUENCY : always


            joehw Joe Wang
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: