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

StAXSource assumes presence of location on events

    XMLWordPrintable

Details

    Description

      ADDITIONAL SYSTEM INFORMATION :
      macOS 10.13.6

      A DESCRIPTION OF THE PROBLEM :
      StAXSource uses the first event of the reader to determine the system ID. It uses the location of the event unconditionally. However, a reader which generates synthetic events doesn't necessarily have a location for its events. Moreover, it is allowed for the system ID to be null. Therefore, line 122 should become the following:

      systemId = Optional.ofNullable(event.getLocation()).map(Location::getSystemId).orElse(null);


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Call the constructor with an XMLEventReader that generates synthetic events.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Correct construction and getSystemdId() returns null.
      ACTUAL -
      NullPointerException at line 122.

      FREQUENCY : always


      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: