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

SecurityManager.checkPackageDefinition throws unexpected NPE

XMLWordPrintable

    • tiger
    • generic
    • generic
    • Verified



      Name: skR10005 Date: 10/06/2003


      The following api tests fail on JDK1.5.0-b22:
      api/java_lang/SecurityManager/index.html#CheckXXX[SecurityManager0036]
      api/java_lang/SecurityManager/index.html#CheckXXX[SecurityManager0037]

      The API specification of the method SecurityManager.checkPackageDefinition
      reads nothing about NullPointerException, but the following simple example
      fails since JDK1.5.0-b20.

      ===============================test.java=======================
      import java.security.Security;

      public class test {
          public static void main(String[] argv) {
              SecurityManager securityExc = new SecurityManager();
              try {
                  Security.setProperty("package.definition", "pack1, pack2, pack3");
              } catch (SecurityException se) {
                  System.out.println("SecurityException:" + se);
              }
                  
              try {
                  securityExc.checkPackageDefinition("pack0");
              } catch (SecurityException se) {
                  System.out.println("SecurityException:" + se);
              }
          }
      }
      ===============================================================
      $ javac -d . test.java
      $ java -version
      java version "1.5.0-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta-b20)
      Java HotSpot(TM) Client VM (build 1.5.0-beta-b20, mixed mode)
      $ java -cp . test
      Exception in thread "main" java.lang.NullPointerException
              at
      java.lang.SecurityManager.checkPackageDefinition(SecurityManager.java:1569)
              at test.main(test.java:13)

      $ 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)
      $ java -cp . test
      Exception in thread "main" java.lang.NullPointerException
              at
      java.lang.SecurityManager.checkPackageDefinition(SecurityManager.java:1569)
              at test.main(test.java:13)

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

            mullan Sean Mullan
            serjsunw Serj Serj (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: