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

XMLFormatter.getHead(null) throws NPE

XMLWordPrintable

    • b26
    • sparc
    • solaris_2.6
    • Verified



      Name: sdR10048 Date: 10/06/2003


      Filed By : SPB JCK team (###@###.###)
      JDK : java full version "1.5.0-beta-b22"

      Specification excerpt:
      ======================
      --------- J2SE API spec v.1.5 ---------
      ...
      public String getHead(Handler h)
      Return the header string for a set of XML formatted records.

      Overrides:
      getHead in class Formatter
      Parameters:
      h - The target handler (can be null)
      Returns:
      header string
      ...
      ---------- end-of-excerpt ---------------

      Problem description
      ===================
      java.util.logging.XMLFormatter.getHead(null) throws NullPointerException.
      But should not as spec says. See demo.
          
      Minimized test:
      ===============
      ------- T.java -------
      import java.util.logging.XMLFormatter;

      class T {
          public static void main(String args[]) {
              XMLFormatter formatter = new XMLFormatter();
              formatter.getHead(null);
          }
      }

      ------- end-of-T.java -------

      Minimized test output:
      ======================
      ] ~/tmp
      ] java T
      Exception in thread "main" java.lang.NullPointerException
              at java.util.logging.XMLFormatter.getHead(XMLFormatter.java:207)
              at T.main(T.java:6)

      ] ~/tmp
      ] java -version
      java version "1.5.0-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta-b22)
      Java HotSpot(TM) Client VM (build 1.5.0-beta-b22, mixed mode)

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

            caustinsunw Calvin Austin (Inactive)
            dsvsunw Dsv Dsv (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: