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

java.util.logging.Formatter.get[Head|Tail]: no NPE

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Duplicate
    • Affects Version/s: 1.4.0
    • Fix Version/s: None
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • CPU:
      sparc
    • OS:
      solaris_7

      Description



      Name: sdR10048 Date: 11/10/2002


      -- T.java --
      import java.util.logging.Formatter;
      import java.util.logging.LogRecord;

      class MyFormatter extends Formatter {
          public MyFormatter() {
          }
          public String format(LogRecord record) {
              return "";
          }
      }

      class T {
          public static void main(String args[]) {
              MyFormatter formatter = new MyFormatter();
              formatter.getHead(null);
              formatter.getTail(null);
              System.out.println("No NPE.");
          }
      }
      -- Output --
      No NPE.

      ------------
      Javadoc says:

      (1)

      public String getHead(Handler h)

      Return the header string for a set of formatted records.

      This base class returns an empty string, but this may be overriden by
      subclasses.

      Parameters:
          h - The target handler.
      Returns:
          header string

      (2)

      doc/api/java/util/logging/package-summary.html

      Null Pointers

      In general, unless otherwise noted in the javadoc, methods and
      contructors will throw NullPointerException if passed a null argument.
      The one broad exception to this rule is that the logging convenience
      methods in the Logger class (the config, entering, exiting, fine,
      finer, finest, log, logp, logrb, severe, throwing, and warning
      methods) will accept null values for all arguments except for the
      initial Level argument (if any).

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

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              ghamiltosunw Graham Hamilton (Inactive)
              Reporter:
              dsvsunw Dsv Dsv (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: