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

javax.xml.XmlEventReader swallows whitespace after StartDocument event

    XMLWordPrintable

    Details

    • Subcomponent:
    • Introduced In Build:
      b01
    • Introduced In Version:
      16
    • CPU:
      generic
    • OS:
      generic

      Description

      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


        Attachments

        1. EventReaderTest.java
          4 kB
          Andrew Wang
        2. EventReaderTest.jtr
          22 kB
          Andrew Wang

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved: