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

Enum.valueOf(null) throws NullPointerException

XMLWordPrintable

    • b95
    • generic
    • generic

      All the classes that extend java.lang.Enum class have the method valueOf(String name). The spec says that if this enum type has no constant with the specified name then IllegalArgumentException is thrown. But if the user pass null as a name then in fact NullPointerException is thrown but not IAE.
      ###@###.### 2005-07-07 15:29:00 GMT

      It is necessary to document the fact of throwing NPE in the spec.
      ###@###.### 2005-07-07 15:29:00 GMT

      Moved "suggested fix" note to description.

      ###@###.### 2005-07-14 18:08:57 GMT

            sseligmasunw Scott Seligman (Inactive)
            ydanilev Yury Danilevich (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: