(process) System.getenv(null) does not throw NPE

XMLWordPrintable

    • b26
    • generic
    • generic



      Name: skR10005 Date: 10/02/2003


      New JCK test
      api/java_lang/System/index.html#getenv[getenv001]
      fails on jdk1.5.0-b21.

      API spec for method System.getenv(String name) reads:
        "NullPointerException - if name is null"

      But JDK implementation does not throw NPE.
      To reproduce bug the following simple test can be used:
      ========================test.java======================
      public class test {
          public static void main(String[] argv) {
              System.getenv(null);
          }
      }
      =======================================================
      $ javac -d . test.java
      novo148$ /export/ld25/java/dest/jdk1.5.0/solaris-sparc/bin/java -version
      java version "1.5.0-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta-b21)
      Java HotSpot(TM) Server VM (build 1.5.0-beta-b21, mixed mode)
      $ /export/ld25/java/dest/jdk1.5.0/solaris-sparc/bin/java -cp . test
      $

      As we can see, no exception is thrown.

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

            Assignee:
            Martin Buchholz
            Reporter:
            Serj Serj (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: