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

(doc) XMLStreamException constructors should document NPE when location is null

    XMLWordPrintable

Details

    • Bug
    • Resolution: Future Project
    • P3
    • 5.0
    • 6
    • xml

    Description

      Problem description:
      ====================
      The following constructors in the javax.xml.stream.XMLStreamException class
          XMLStreamException(String msg, Location location)
          XMLStreamException(String msg, Location location, Throwable th)
      throw NullPointerException when location is null, but do not document such behaviour.

      Minimized test:
      ===============
      -- Test.java --
      import javax.xml.stream.*;

      public class Test {
          public static void main(String[] args) {
              XMLStreamException obj = null;
              try {
                  System.out.println(
                          "Check XMLStreamException(String msg, Location location)");
                  obj = new XMLStreamException("msg", (Location) null);
                  System.out.println("PASSED");
              } catch (NullPointerException npe) {
                  System.out.println(
                          "FAILED. Unexpected NullPointerException is thrown");
              }

              try {
                  System.out.println(
                          "Check XMLStreamException(String msg, Location location, Throwable th)");
                  obj = new XMLStreamException(
                          "msg", (Location) null, new Throwable());
                  System.out.println("PASSED");
              } catch (NullPointerException npe) {
                  System.out.println(
                          "FAILED. Unexpected NullPointerException is thrown");
              }
          }
      }
      -- End of Test.java --

      Minimized test output:
      ======================
      $java -showversion Test
      java version "1.6.0"
      Java(TM) SE Runtime Environment (build 1.6.0-b105)
      Java HotSpot(TM) Client VM (build 1.6.0-b105, mixed mode)

      Check XMLStreamException(String msg, Location location)
      FAILED. Unexpected NullPointerException is thrown
      Check XMLStreamException(String msg, Location location, Throwable th)
      FAILED. Unexpected NullPointerException is thrown

      Attachments

        Activity

          People

            Unassigned Unassigned
            ygaevsky Yuri Gaevsky (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: