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

Console.read{Password,Line}(String,Object...) do not throw NPE on null argument

XMLWordPrintable

    • b65
    • generic
    • windows_xp

      Console methods format, printf, readPassword, readLine have a parameter fmt:
      -----------------------
          * @param fmt
          * A format string as described in <a
          * href="../util/Formatter.html#syntax">Format string syntax</a>.

      -----------------------

      1) in readPassword(String, Object...) method description there is written:
      ---
          * @param fmt
          * A format string as described in <a href="#syntax">Format string
          * syntax</a> for the prompt text.
      ---
      *href* is wrong. Link doesn't work.

      2) methods printf(String fmt, Object... args) and format(String fmt, Object... args) throw NullPointerException if fmt = null, but methods readPassword(String fmt, Object... args) and readLine(String fmt, Object... args) don't throw it. Description of the "fmt" is the same across the methods and according to the Console class description, we have:
      -----------------------
       Unless otherwise specified, passing a null argument to any method in this class will cause a NullPointerException to be thrown.
      -----------------------
      Such behaviour seems to be strange.

            sherman Xueming Shen
            ynovozhi Yulia Novozhilova (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: