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

Clarify that XMLStreamReader.next() throws NoSuchElementException when hasNext() is false

    Details

    • Type: CSR
    • Status: Closed
    • Priority: P4
    • Resolution: Approved
    • Fix Version/s: 12
    • Component/s: xml
    • Labels:
      None
    • Subcomponent:
    • Compatibility Risk:
      minimal
    • Compatibility Risk Description:
      There is no compatibility risk. This change removes only an incorrect statement.
    • Interface Kind:
      Java API
    • Scope:
      SE

      Description

      Summary

      Clarifies that XMLStreamReader.next() throws NoSuchElementException when hasNext() is false

      Problem

      XMLStreamReader.next() specified in the throw statement that NoSuchElementException should be thrown when hasNext() returns false . However, it also contained an unnecessary statement in a note of the general specification that IllegalStateException will be thrown in the situation.

      Solution

      Remove the statement that stated IllegalStateException will be thrown.

      Specification

      javax.xml.stream.XMLStreamReader

      NOTE: empty element (such as <tag/>) will be reported with two separate events: START_ELEMENT, 
      - END_ELEMENT - This preserves parsing equivalency of empty element to <tag></tag>. This method 
      - will throw an IllegalStateException if it is called after hasNext() returns false. 
      + END_ELEMENT - This preserves parsing equivalency of empty element to <tag></tag>. 

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                joehw Joe Wang
                Reporter:
                webbuggrp Webbug Group
                Reviewed By:
                Lance Andersen
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: