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

XPathException constructors throw unspecified NullPointerException

XMLWordPrintable

    • b26
    • generic
    • generic
    • Verified

      Name: eaR10174 Date: 10/22/2003


        The constructor of the class javax.xml.xpath.XPathException
        
            public XPathException(Exception exception)

      throws NullPointerException in case when the parameter exception is null (see test.java).

        The constructor

            public XPathException(String message, Throwable e)
            
      throws NullPointerException in case when the parameter message is null and the parameter e
      is null (see test.java).

      This behavior is not specified in the javadoc of the class XPathException.

        The bug appears in jdk1.5.0beta-b24 and affects new JCK1.5 tests:
        
          api/javax_xml/xpath/XPathException/index.html#Ctor[Ctor002]
          api/javax_xml/xpath/XPathException/index.html#Ctor[Ctor009]

      ------------------------------------test.java-----------------------------
      import javax.xml.xpath.XPathException;

      public class test {

          public static void main (String[] args) {
              try {
                  XPathException xPathException = new XPathException((Exception)null);
                  System.out.println("OK: XPathException((Exception)null)");
              } catch (NullPointerException e) {
                  e.printStackTrace();
              }

              try {
                  XPathException xPathException = new XPathException(null, null);
                  System.out.println("OK: XPathException(null, null)");
              } catch (NullPointerException e) {
                  e.printStackTrace();
              }
          }
      }
      --------------------------------------------------------------------------
      % java -showversion test
      java version "1.5.0-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta-b24)
      Java HotSpot(TM) Client VM (build 1.5.0-beta-b24, mixed mode)

      java.lang.NullPointerException
              at javax.xml.xpath.XPathException.<init>(XPathException.java:94)
              at test.main(test.java:7)
      java.lang.NullPointerException
              at javax.xml.xpath.XPathException.<init>(XPathException.java:110)
              at test.main(test.java:14)
      --------------------------------------------------------------------------

      ======================================================================

            jsuttorsunw Jeff Suttor (Inactive)
            evgsunw Evg Evg (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: